techmanbd Posted February 1, 2008 Posted February 1, 2008 Here is the following code. I have a class, and access it in my main form. Part of my class comGPIB public class comGPIB { Board brd = new Board(); Device devdev = new Device(0,0); public int iHELLO; public Device [] devGPIB = new Device[5]; public bool boolPSConnected; public enum Dev {PS=0, AGSwitch1=1, AGSwitch2=2, KeithleyMM=3};// Used for which array for devGPIB public enum PS {Agilent=0,Xantrex=1}; //Used when for which Power Supply is found on the GPIB Network } And here is the code from my main form comGPIB cGPIB = new comGPIB();// this is up at the top where my variables are private void btnPractice_Click(object sender, System.EventArgs e) { string readIt = cGPIB.readGPIB(cGPIB.devGPIB[1]); this.lblPract.Text = readIt; } When I do cGPIB. in the drop down box I can see the public integer and the public boolean variable, but not the enums I created. Now when I do this I see it and it work, by putting the namespace. int i = HBAS_PVFT_Rack.comGPIB.Dev.AGSwitch1; Is there an explanation for this? I tried reading the help files and didn't see anything on why I need the namespace for the enum in that class. Thanks, Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
Administrators PlausiblyDamp Posted February 2, 2008 Administrators Posted February 2, 2008 IIRC I think it might be just an issue with C# intellisense in VS 2002 / 2003 - it gets a lot better in later versions ;) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
techmanbd Posted February 4, 2008 Author Posted February 4, 2008 Thanks, yes I do see other little bugs, as when I am typing the index cursor stays in one spot while the letters are being typed. At first I kept thinking I hit something for it to go back. Unfortunatley I don't have the luxury of my company getting the latest. Plus I won't be working here too much longer as they are closing the facility and moving to China. Maybe my next job I can get the newer version. Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
Leaders snarfblam Posted February 5, 2008 Leaders Posted February 5, 2008 I think the issue here is that in one case you are trying to access the enum through a variable (cGPIB), and in the other case you are accessing the enum through the type (comGPIB). The enum is not a member of the class. It is a nested type. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.