"Jack Russell" <ja***@norubbish.tpg.com.auschrieb:
>I have the following
If MyOpenFiledialog1.ShowDialog = DialogResult.OK then
This works fine in VB2003 but in express I get the warning
"Access of shared member, constant member, enum member or nested type
through an instance; qualifying expression will not be evaluated"
What does this mean / what is wrong?
The 'DialogResult' on the right side of the '=' is not considered to be a
type name because the type name is hidden by the form's 'DialogResult'
property. In VB it's generally possible to access members of a class which
are marked as 'Shared' (or member of an enumeration type) via a reference to
an instance of the type. The form's 'DialogResult' property contains an
instance of the type 'DialogResult'. 'OK' is a member of an enumeration
type, namely 'DialogResult'.
You can either disable the warning newly introduced in VB 2005, or you can
qualify the type name on the right hand side of the assignment in order to
prevent it to be bound to the form's property:
\\\
Imports WinForms = System.Windows.Forms
....
If ... = WinForms.DialogResult.OK Then
...
End If
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>