473,769 Members | 1,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

instance reference; qualify it with a type name instead

C:\Documents and Settings\watts\ My Documents\Visua l Studio
Projects\boeing \showPMACfg\vue PMAcfg\vuePMAcf g.cs(88):
Static member 'vuePMAcfg.pmaD ataHash.pmaData Hash1' cannot
be accessed with an instance reference; qualify it with a
type name instead

OK I have this class And the hash and the function shows
up in type ahead. I tried declaring it and later accessing
it like this:

private vuePMAcfg.pmaDa taHash pmaDataObj;
....
pmaDataShareArr ay.Add(pmaDataO bj.pmaDataHash1 );

But I get the error above ... if I try
private vuePMAcfg.pmaDa taHash pmaDataObj = new
vuePMAcfg.pmaDa taHash(); ... I get the same error.

What does the error mean and how do I get to the items &
function ??? Thanks

public class pmaDataHash
{
public pmaDataHash()
{
}
public static Hashtable pmaDataHash1 = new
Hashtable();
public string GetFolderByleve l(string filePath,int level)
}

Nov 13 '05 #1
2 58424
Hi andrew,

The static methods/properties or variables need to be qualified with the
class name:

pmaDataShareArr ay.Add(pmaDataO bj.pmaDataHash1 ) needs to be written like:
pmaDataShareArr ay.Add( pmaDataHash.pma DataHash1);

See that the pmaDataHash1 belong to the class as a whole, ont to a
particular instance, therefore all the instances(objec ts of type
pmaDataHash) will share the same pmaDataHash1.

What is what you are trying to do anyway?

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"andrew" <an************ @boeing.com> wrote in message
news:03******** *************** *****@phx.gbl.. .
C:\Documents and Settings\watts\ My Documents\Visua l Studio
Projects\boeing \showPMACfg\vue PMAcfg\vuePMAcf g.cs(88):
Static member 'vuePMAcfg.pmaD ataHash.pmaData Hash1' cannot
be accessed with an instance reference; qualify it with a
type name instead

OK I have this class And the hash and the function shows
up in type ahead. I tried declaring it and later accessing
it like this:

private vuePMAcfg.pmaDa taHash pmaDataObj;
...
pmaDataShareArr ay.Add(pmaDataO bj.pmaDataHash1 );

But I get the error above ... if I try
private vuePMAcfg.pmaDa taHash pmaDataObj = new
vuePMAcfg.pmaDa taHash(); ... I get the same error.

What does the error mean and how do I get to the items &
function ??? Thanks

public class pmaDataHash
{
public pmaDataHash()
{
}
public static Hashtable pmaDataHash1 = new
Hashtable();
public string GetFolderByleve l(string filePath,int level)
}

Nov 13 '05 #2
Hello Andrew,

The error message already showed where the problem is.

In the code, the pmaDataHash1 is a static member of pmaDataHash class, it
must be refer to by pmaDataHash's static function and it must be associated
with this type, not an instance of this type.

In your code listed out, I can not find the place you refer to pmaDataHash1
data member, but from the error message, you maybe associate it with an
instance.

Hope this helps.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "andrew" <an************ @boeing.com>
!Sender: "andrew" <an************ @boeing.com>
!Subject: instance reference; qualify it with a type name instead
!Date: Mon, 14 Jul 2003 11:31:10 -0700
!Lines: 31
!Message-ID: <03************ *************** *@phx.gbl>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcNKNhkxgy1v8Bo BTHKuIYtvBPL1jg ==
!Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
!Path: cpmsftngxa06.ph x.gbl
!Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1689 93
!NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
!X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
!
!C:\Documents and Settings\watts\ My Documents\Visua l Studio
!Projects\boein g\showPMACfg\vu ePMAcfg\vuePMAc fg.cs(88):
!Static member 'vuePMAcfg.pmaD ataHash.pmaData Hash1' cannot
!be accessed with an instance reference; qualify it with a
!type name instead
!
!OK I have this class And the hash and the function shows
!up in type ahead. I tried declaring it and later accessing
!it like this:
!
!private vuePMAcfg.pmaDa taHash pmaDataObj;
!...
!pmaDataShareAr ray.Add(pmaData Obj.pmaDataHash 1);
!
!But I get the error above ... if I try
!private vuePMAcfg.pmaDa taHash pmaDataObj = new
!vuePMAcfg.pmaD ataHash(); ... I get the same error.
!
!What does the error mean and how do I get to the items &
!function ??? Thanks
!
!public class pmaDataHash
!{
! public pmaDataHash()
! {
! }
! public static Hashtable pmaDataHash1 = new
!Hashtable();
!public string GetFolderByleve l(string filePath,int level)
!}
!
!

Nov 13 '05 #3

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

Similar topics

18
6956
by: John M. Gabriele | last post by:
I've done some C++ and Java in the past, and have recently learned a fair amount of Python. One thing I still really don't get though is the difference between class methods and instance methods. I guess I'll try to narrow it down to a few specific questions, but any further input offered on the subject is greatly appreciated: 1. Are all of my class's methods supposed to take 'self' as their first arg? 2. Am I then supposed to call...
3
1626
by: Angelos Karantzalis | last post by:
Hi y'all ... I've just come across a rather weird problem. i'm using the following code to get the names of the public properties of an object: public static string GetPropertyNames(object instance){ Type objType = instance.GetType(); PropertyInfo props = objType.GetProperties();
6
22534
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object instance (in this case 'myDog'). Of course it would be better if I could somehow know from within write() that the name of the object instance was 'myDog' without having to pass it as a parameter. //////////////////////////////// function...
3
4234
by: Adam | last post by:
We have a web site that uses .vb for the web pages and .cs for a class module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does work with .NET 1.1. When trying to access a page that needs the class module I get an error on web site: Object reference not set to an instance of an object Here is where the error is:
2
21431
by: Mythran | last post by:
System.Drawing.SystemColors is a class with all static properties. Here is what my short-ranged goal is... I want to enumerate all of the SystemColors properties and print the name (using reflection), and I am able to do this: PropertyInfo props = typeof(SystemColors).GetProperties(); foreach (PropertyInfo prop in props) { Console.WriteLine(prop.Name); }
10
3876
by: Arpan | last post by:
Consider the following code that adds a table to a DataSet dynamically: <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) 'Create an empty DataSet Dim dSet As New DataSet 'Create a new table & add columns Dim dTable As New DataTable("Users") dTable.Columns.Add("ID", Type.GetType("System.Int32"))
35
3232
by: Chris | last post by:
Hi, I tried to create a class which must change the propety 'visible' of a <linktag in the masterpage into 'false' when the user is logged. But i get the error: "Object reference not set to an instance of an object" for the line 'If mpg.FindControl("lkred").Visible = True Then'. I couldn't find sofar the solution. Any help would be appreciated ... Thanks
275
12381
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
2
4824
by: alireza6485 | last post by:
Hi: I have 3 class/Methods: the first one:just beeps the second one:ask the user to Enter the number of beep The last one:Activate and runs. I get the following Error:"instance reference; qualify it with a type name instead " Can you please re-write the code and fix it for me,Thanks. First One:
0
9589
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
10211
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...
1
9994
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,...
0
9863
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
6673
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
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
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.