471,123 Members | 965 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,123 software developers and data experts.

Visual Studio 2005 - (VB) Public definitions in module

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
Aug 4 '06 #1
2 1116

"Henry Jones" <he********@yada.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>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.
Aug 5 '06 #2

"Henry Jones" <he********@yada.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>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.
Aug 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by =?Utf-8?B?UGV0ZXI=?= | last post: by

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.