473,769 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

warning on accessing shared method

Why do I get a warning:
Access of shared member, constant member, enum member or nested type through
an instance; qualifying expression will not be evaluated

When accessing a shared method in the framework. (for example)
If Control.MouseBu ttons = MouseButtons.No ne Then....

What is the point of includes if they don't prevent this type of warning?
Will I always need to explicitly specify the name space?
If Control.MouseBu ttons = Windows.Forms.M ouseButtons.Non e Then .....
Thanks for any insight into this!
Jul 25 '06 #1
1 1310
iamahulk <ia******@discu ssions.microsof t.comwrote:
Why do I get a warning:
Access of shared member, constant member, enum member or nested type through
an instance; qualifying expression will not be evaluated

When accessing a shared method in the framework. (for example)
If Control.MouseBu ttons = MouseButtons.No ne Then....

What is the point of includes if they don't prevent this type of warning?
Will I always need to explicitly specify the name space?
If Control.MouseBu ttons = Windows.Forms.M ouseButtons.Non e Then .....
This is only because MouseButtons is the name of a property as well as
a type. If MouseButtons weren't a property in the current class you're
writing the code in, it would be absolutely fine. For instance, you
could write the above in a class which didn't derive from anything
other System.Object and it would be fine.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jul 25 '06 #2

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

Similar topics

8
3559
by: Mike Caputo | last post by:
In VB.NET, need to be able to access certain properties on my main form from other forms. These are properties that may be changed by the user, so I have to be able to get to them throughout the application. How can I access the current instance of a specific Form object? For example: Class frmOne ....... Public Readonly Property XYZ() as String Get
9
5404
by: Bob Day | last post by:
VS 2003, vb.net , sql msde... I have an application with multiple threads running. Its a telephony application where each thread represents a telephone line. For code that would be the same for each thread, I put in Shared methods as below. It is only now that I am realizing the complexity of multiple threads accessing shared methods. And, quite honestly, I am very confused. I have tried System.Threading.Monitor.Enter, Synclock,...
0
950
by: Rob R. Ainscough | last post by:
When I run my Test application I get the following error: Warning: The dependency 'MyCompany.Utilities, Version=1.0.1852.27525, Culture=neutral' in project 'MyCompany.Remote' cannot be copied to the run directory because it would overwrite the reference 'MyCompany.Utilities, Version=1.0.1852.27795, Culture=neutral'. MyCompany.Utilities, MyCompany.Remote, are class libraries (compiled to DLL) I created in a "common" solution. I added...
5
2808
by: Khalique | last post by:
Hi everyone, I Hope that someone will be able to give me a hint to the solution to my problem. I have developed a web service (vb.net) that needs to access the folders / files and copy files to and from the public folder on the client machine. It is not a public web service, only accessible on intranet. The anonymous access is disabled. Windows authentication is enabled. Web.Config sets <identity impersonate="true" /> Using a test app,...
4
3780
by: Khalique | last post by:
I have built a web service whose purpose is to copy files from a secure place to client machine and vice versa. The problem I am having is perhaps related to permissions and access rights. For testing purposes, the secure place is setup on the client machine. The client (window app) calls the web service (on a different machine) and connects successfully to the web service. However, when client calls a method that copies the file from...
5
4250
by: AnDrE | last post by:
Hello I'm developing a application in VB .NET 2005 and I need to access text files. I'm using the System.IO.File library and I have this code: Dim oFile As System.IO.File Dim oRead As System.IO.StreamReader oRead = oFile.OpenText(FullPath & "\file.conf")
2
1069
by: AZNewsh | last post by:
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.SecureSocketsLayer.FastBind I am managing to clear up most warnings but am unsure about this one, all help appreciated.
2
1610
by: BBM | last post by:
I may be putting too fine a point on this, but I'd like to be able to know the class name of a shared method from within the method. BTW, the shared method is in a "MustInherit" class. So it looks like this... Public MustInherit Class BaseClass Public Shared Sub DoIt() ' Need to know which class is "running"
2
1115
by: Brian | last post by:
Hi, No matter how i do this, I get the same warning. I don't understand the warning.... Dim FILETYPE as string() = {"tree;.tree;*.tree"} for x as integer = 0 to ubound(FILETYPE) Orginal line--------------------------------------- FILETYPE(0) = Lcase(FILETYPE(0).Concat(".", FILETYPE(0))) --------------------------------------------------
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10035
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9851
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.