473,473 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

2005 Conversion Warning

Access of shared member, constant member, enum member or nested type
through an instance; qualifying expression will not be evaluated.

Here is the line that apparently causes it:

DirectoryServices.AuthenticationTypes.SecureSocket sLayer.FastBind

I am managing to clear up most warnings but am unsure about this one,
all help appreciated.

Thanks

Jul 24 '06 #1
2 1050
Typically this is caused by trying to call a static/shared method from an
instance of a class rather than calling it directly. Consider the following:

Public Class Foo
Public Shared Sub DoBar()
Messagebox("Doing the bar")
End Sub
End Class

Now if you want to call the DoBar method, you can simply use the following
syntax:
Foo.DoBar()

In your case, you are trying to call the method through an instance of the
Foo class rather than the foo type as follows:
Dim myFoo as New Foo
myFoo.DoBar()

The compiler is telling you that it won't use the instance myFoo to call
DoBar as it is a Shared method. Instead, it will call Foo.DoBar directly.
It can get tricky to debug if you use an instance name that is the same as
the type of the object as follows:
Dim Foo as New Foo
Foo.DoBar()

Although the compiler allows this syntax, I try to avoid it (or in c# with
the case sensitive changes) as it makes for more challenging debugging and
maintenance. Here, you are trying to call DoBar through the instance rather
than the Type, but this might not be apparent on first glance.

One other case where you will see this message is where there are potential
namespace conflicts which cause an instance member to be used rather than
the base type.

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
Access of shared member, constant member, enum member or nested type
through an instance; qualifying expression will not be evaluated.

Here is the line that apparently causes it:

DirectoryServices.AuthenticationTypes.SecureSocket sLayer.FastBind

I am managing to clear up most warnings but am unsure about this one,
all help appreciated.

Thanks

Jul 24 '06 #2
Thank you for taking the time to answer.
Jim Wooley wrote:
Typically this is caused by trying to call a static/shared method from an
instance of a class rather than calling it directly. Consider the following:

Public Class Foo
Public Shared Sub DoBar()
Messagebox("Doing the bar")
End Sub
End Class

Now if you want to call the DoBar method, you can simply use the following
syntax:
Foo.DoBar()

In your case, you are trying to call the method through an instance of the
Foo class rather than the foo type as follows:
Dim myFoo as New Foo
myFoo.DoBar()

The compiler is telling you that it won't use the instance myFoo to call
DoBar as it is a Shared method. Instead, it will call Foo.DoBar directly.
It can get tricky to debug if you use an instance name that is the same as
the type of the object as follows:
Dim Foo as New Foo
Foo.DoBar()

Although the compiler allows this syntax, I try to avoid it (or in c# with
the case sensitive changes) as it makes for more challenging debugging and
maintenance. Here, you are trying to call DoBar through the instance rather
than the Type, but this might not be apparent on first glance.

One other case where you will see this message is where there are potential
namespace conflicts which cause an instance member to be used rather than
the base type.

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
Access of shared member, constant member, enum member or nested type
through an instance; qualifying expression will not be evaluated.

Here is the line that apparently causes it:

DirectoryServices.AuthenticationTypes.SecureSocket sLayer.FastBind

I am managing to clear up most warnings but am unsure about this one,
all help appreciated.

Thanks
Aug 2 '06 #3

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

Similar topics

6
by: sathyashrayan | last post by:
Following are the selected thread from the date:30-jan-2005 to 31-jan-2005. I did not use any name because of the subject is important. You can get the original thread by typing the subject...
3
by: Steve Richter | last post by:
here is a warning I am getting in a C++ .NET compile: c:\SrNet\jury\JuryTest.cpp(55) : warning C4927: illegal conversion; more than one user-defined conversion has been implicitly applied while...
1
by: Peter Oliphant | last post by:
At one point I started a thread about how hard it is to convert 2003 Managed C++ code to 2005 /clr C++ code, and said it was too hard. Well, now that I've been doing it for a while, it isn't really...
13
by: Andy | last post by:
Hi As I try to learn VB programing I've been playing around with sourcecode from projects hosted on sourceforge. If I open this code in VB 2005 (it is originally developed in VB 2003), it will...
6
by: Tom McL. | last post by:
I'm trying to move a program that was designed using Visual Studio 2003 and (Visual Basic) into Visual Studio 2005. When it runs I get the following warning in the Error List Window and I'm not...
0
by: Sergio Martins | last post by:
I have a web site in vb.net 2003 that I what to convert to vb.net 2005. I open my web site in the visual studio 2005 by Local IIS option. I follow the steps of the visual studio conversion wizard....
0
by: malini | last post by:
Hi I am new to vc++. currently using VC 2005 version 8 Someone help me solve this. lpppublishdimincent.cpp(294) : warning C4244: 'argument' : conversion from 'const lpmINT64' to 'char', possible...
4
by: Juha Nieminen | last post by:
Unknownmat wrote: VS2005 has a bug related to this. When you use size_t, it internally converts it to 'unsigned int'. In some situations it forgets that the type was actually size_t and only...
9
by: Eric | last post by:
I am working on a large, old code base and attempting to move it to GCC 4.2. Throughout the code, there is stuff like: char *aVar = "aString"; or void aFunc( char *aVar) { ... } aFunc(...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.