473,785 Members | 3,067 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What exactly does this message mean?

I have VS2005 installed on my destop and on my laptop. I created this app
with my desktop and i don't get this. Run the IDE on my laptop and this is
what I get?

Access of shared member, constant member, enum member or nested type through
an instance; qualifying expression will not be evaluated.
Aug 27 '06 #1
7 1830
"Brian Shafer" <Br*********@di scussions.micro soft.comschrieb :
>I have VS2005 installed on my destop and on my laptop. I created this app
with my desktop and i don't get this. Run the IDE on my laptop and this is
what I get?

Access of shared member, constant member, enum member or nested type
through
an instance; qualifying expression will not be evaluated.
You are attempting to access a member which is marked as 'Shared' using a
reference referencing an instance of the type. Instead, simply write '<type
name>.<member name>'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Aug 27 '06 #2
I just want to make a comment, I am not sure what the error refers to,
however, I have seen similiar warning signs on some of the programs I
have written. Example, If I want to sort an array, I would assume I
could use syntax such as:

MyArray.Sort(My Array)

This would cause the same warning that you have mentioned, but if I
change my syntax to something like:

system.Array.So rt(MyArray) and the error warning would go away.

I personally think its a coding issue, you might want to check to see
if both of your programs are referencing the same NameSpaces (import
statements).
Herfried K. Wagner [MVP] wrote:
"Brian Shafer" <Br*********@di scussions.micro soft.comschrieb :
I have VS2005 installed on my destop and on my laptop. I created this app
with my desktop and i don't get this. Run the IDE on my laptop and this is
what I get?

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

You are attempting to access a member which is marked as 'Shared' using a
reference referencing an instance of the type. Instead, simply write '<type
name>.<member name>'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Aug 27 '06 #3
It is the same source code... just copied to my laptop...

"JimmyKoolPantz " wrote:
I just want to make a comment, I am not sure what the error refers to,
however, I have seen similiar warning signs on some of the programs I
have written. Example, If I want to sort an array, I would assume I
could use syntax such as:

MyArray.Sort(My Array)

This would cause the same warning that you have mentioned, but if I
change my syntax to something like:

system.Array.So rt(MyArray) and the error warning would go away.

I personally think its a coding issue, you might want to check to see
if both of your programs are referencing the same NameSpaces (import
statements).
Herfried K. Wagner [MVP] wrote:
"Brian Shafer" <Br*********@di scussions.micro soft.comschrieb :
>I have VS2005 installed on my destop and on my laptop. I created this app
with my desktop and i don't get this. Run the IDE on my laptop and this is
what I get?
>
Access of shared member, constant member, enum member or nested type
through
an instance; qualifying expression will not be evaluated.
You are attempting to access a member which is marked as 'Shared' using a
reference referencing an instance of the type. Instead, simply write '<type
name>.<member name>'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Aug 27 '06 #4
MyArray.Sort(My Array)
system.Array.So rt(MyArray) and the error warning would go away.
The difference in these statements is that MyArray is a variable, so it may
be nothing and null reference exception occurs. Of course, this is a bad
example since the same variable is used as parameter as well, so an
exception would actually be thrown in both cases, but you got the point?

-h-
Aug 27 '06 #5
"Heikki Leivo" <he************ @cadworksdotfi. removethisschri eb:
>MyArray.Sort(M yArray)
system.Array.S ort(MyArray) and the error warning would go away.

The difference in these statements is that MyArray is a variable, so it
may be nothing and null reference exception occurs. Of course, this is a
bad example since the same variable is used as parameter as well, so an
exception would actually be thrown in both cases, but you got the point?
Note that 'Array.Sort' is a shared method, so it can eben be called on a
'Nothing' reference.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Aug 27 '06 #6
Note that 'Array.Sort' is a shared method, so it can eben be called on a
'Nothing' reference.
Well, thanks for correcting. This ain't my first time being wrong. I have
always thought that this was the true meaning of the mentioned error
message.

-h-
Aug 27 '06 #7
It is the same source code... just copied to my laptop...
>>"Brian Shafer" <Br*********@di scussions.micro soft.comschrieb :

I have VS2005 installed on my destop and on my laptop. I created
this app with my desktop and i don't get this. Run the IDE on my
laptop and this is what I get?

Access of shared member, constant member, enum member or nested
type
through
an instance; qualifying expression will not be evaluated.
You are attempting to access a member which is marked as 'Shared'
using a reference referencing an instance of the type. Instead,
simply write '<type name>.<member name>'.
You are probably seeing the FxCop rules being run where they aren't run on
your other computer's IDE (pre 2005 or without the Code Analysis turned on
in the project).

Here's an explanation of the issue. Let's say you have a class called foo
with a shared method bar as follows:

Public Class Foo
Public Shared Sub Bar()
'Do Something
End Sub
End Class

Now, lets consider how you call this method. You can not have a calling method
that calls Bar on an instance of Foo as follows:
Public Sub Main()
Dim instance as new Foo
instance.Bar 'This is invalid
End Sub

Instead, you need to call Bar directly without an instance as follows:
Public Sub Main()
Foo.Bar()
End Sub

Sometimes, you can end up with conflicts in namespaces and although you think
you are calling the shared method directly, you are trying to call it from
an instance as follows:
Public Sub Main()
Dim foo as new Foo
foo.Bar() 'Incorrect
MyApp.Foo.Bar() 'Correct assuming MyApp is the namespace for the application.
End Sub

I hope this helps you understand the situation. Typically, this is a relatively
easy oversight to make and luckily fix as well.
Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
Aug 28 '06 #8

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

Similar topics

112
10368
by: Andy | last post by:
Hi All! We are doing new development for SQL Server 2000 and also moving from SQL 7.0 to SQL Server 2000. What are cons and pros for using IDENTITY property as PK in SQL SERVER 2000? Please, share your experience in using IDENTITY as PK .
125
14852
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
14
2603
by: mjkahn | last post by:
I've read (and read!) that you shouldn't store objects in Session variables. I've read these reasons: - The object takes up memory that may not be freed until the session times out. Better to create the object only when you actually use it. - Causes poor performance because the thread that created the object has to service all requests for it. Assuming I can live with the memory and performance implications (a big if,
121
10179
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
140
7912
by: Oliver Brausch | last post by:
Hello, have you ever heard about this MS-visual c compiler bug? look at the small prog: static int x=0; int bit32() { return ++x; }
1
8743
by: Frank Rizzo | last post by:
Some of the classes in the framework are marked as thread-safe in the documentation. In particular the docs say the following: "Any public static (*Shared* in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe." What exactly does this mean? Does this mean that if I call a shared method from 2 different threads, nothing whacky will happen? Also when it says that instance members...
13
5058
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
15
2145
by: Edwin Knoppert | last post by:
I have searched but info is limitted. In my test app i used a non persistant cookie for forms authentication. slidingExpiration is set to true On run and close and rerun the login remains ok. I have a time-out of one minute and indeed, it directs me to the login if i wait to long. The slidingExpiration does it's work also.
18
1984
by: cj | last post by:
members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. I'm under the impression before you can use a class you have to make an instance of it. So how can a class be threadsafe by itself but an instance of it not be? I guess I don't get what exactly being threadsafe means. Multiple theads can use the same instance of a class?
10
2111
by: Franky | last post by:
I think I misread a post and understood that if I do: System.Windows.Forms.Cursor.Current = Cursors.WaitCursor there is no need to reset the cursor to Default. So I made all the reset statements into comments (placed an ' in front)
0
9645
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
9480
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
10325
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
10148
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...
1
10091
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5381
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
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

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.