473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Error in Vb express

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?

Thanks

Jack Russell
May 25 '07 #1
6 1503

"Jack Russell" <ja***@norubbish.tpg.com.auwrote in message
news:el****************@TK2MSFTNGP02.phx.gbl...
>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?
It works in VB2005 express on my machine


May 25 '07 #2

"Jack Russell" <ja***@norubbish.tpg.com.auwrote in message
news:el****************@TK2MSFTNGP02.phx.gbl...
>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?
There is nothing wrong. It's new in VS 2005, where as, you don't have to
instantiate an object to use one of its methods.

<Copied an example>
This means that the method log writeEntry does not require an instanced
object to run. It is a shared method and therefore you simply need to
specify the classname and method to use.

System.Diagnostics.EventLog.WriteEntry(mcstService Name, "Remoting Host
Service has shut down", EventLogEntryType.Warning, 71)
A shared method is much like a sub in a module - you don't need to create an
instantiate object to use the method.

<Copied>

May 25 '07 #3
Jack,

When you use DialogResult you are referencing the form's DialogResult
property, which is an instance of DialogResult.

To get rid of the warning message, use Windows.Forms.DialogResult.OK.

Kerry Moorman
"Jack Russell" wrote:
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?

Thanks

Jack Russell
May 25 '07 #4
"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/>

May 25 '07 #5
Kerry Moorman wrote:
Jack,

When you use DialogResult you are referencing the form's DialogResult
property, which is an instance of DialogResult.

To get rid of the warning message, use Windows.Forms.DialogResult.OK.

Kerry Moorman
"Jack Russell" wrote:

>>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?

Thanks

Jack Russell
Thanks, why do MS keep making life more complex (no need to answer that
question!)
May 25 '07 #6
Thanks Herfried, glad you are still helping old duffers like me!

Herfried K. Wagner [MVP] wrote:
"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
///
May 25 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: RodBillett | last post by:
Using SmartNavigation. Windows2003 Server Framework 1.0 (3705) IIS6 and I have IIS configured to utilize the 1.0 framework. Any Ideas why I would be getting the following jscript error within...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
2
by: David Hearn | last post by:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Description: An unhandled exception occurred during the execution of the current...
16
by: | last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I keep getting the following error:- Error In:...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
0
by: tony dong | last post by:
Hi there I use vs.net 2005 with standard sql 2005 under machine\sql2005 for instant when I create webpart, the code get from quickstart as follow: <%@ Page Language="C#" %> <%@ Register...
6
by: Chris Love | last post by:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not...
0
by: snowman | last post by:
I have vb and sql server express 2005 installed locally. I cannot add a data connection in vb express. I keep getting the error "An error has occured while establishing......26 - Error Locating...
11
by: kimiraikkonen | last post by:
Hello, I'm very new to C# and just installed VC# 2005 express edition and i have VB 2005 express installed previously. But i saw a thing which may be called as a "Visual C# 2005 express" bug? ...
1
by: finizaini | last post by:
I'm receiving an "Object Expected" Error (Line:309, Char:0). I'm confused as to what is happening.Also, I can't run this code using other browser such as Fire Fox. Thispage only can view using IE....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.