Visual Studio 2005 - (VB) Public definitions in module

H

Henry Jones

I created a module in VS 2005 - Visual Basic Windows Project.

I declared two strings public

Public strConn as string
Public strSQL as string


When I tried to use these variables in my form, they haven't been defined.
What is the difference between VS 2005 and VS 2003? I did the same thing is
VS 2003 and everything worked.

Thanks
 
P

pvdg42

Henry Jones said:
I created a module in VS 2005 - Visual Basic Windows Project.

I declared two strings public

Public strConn as string
Public strSQL as string


When I tried to use these variables in my form, they haven't been defined.
What is the difference between VS 2005 and VS 2003? I did the same thing
is VS 2003 and everything worked.

Thanks
Where, exactly, did you place the declarations, in relation to the form
where you try to reference the object variables?
If your public strings are declared in a separate class, you'll need an
instance of that class to be available to the form code.
 
P

pvdg42

Henry Jones said:
I created a module in VS 2005 - Visual Basic Windows Project.

I declared two strings public

Public strConn as string
Public strSQL as string


When I tried to use these variables in my form, they haven't been defined.
What is the difference between VS 2005 and VS 2003? I did the same thing
is VS 2003 and everything worked.

Thanks
Upon re-reading your post (yes, my face is red), I see you defined the
variables in a VB module, not a class. So disregard my previous.
I have attempted to recreate your problem without success here, in VS 2005.
I declared:

Public s As String in a VB Module, then assigned the address of a string
literal to it, using the Text property of a TextBox. I then was able to
display the string in a label.
All code in a form Button1_Click event procedure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top