Public definitions in module - VS 2005

  • Thread starter Thread starter Henry Jones
  • Start date Start date
H

Henry Jones

I posted in dotnet.general but I think this is a better place to post a VB
question.



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
 
I posted in dotnet.general but I think this is a better place to post a VB
question.



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

The statements as posted are apparently OK otherwise you would get the error, "strConn Not
Declared".

By "Not Defined", I'm guessing that you have not initialized values for the variables.

Gene
 
I goofed in what I stated. When I tried to use the variables in my form, I
received an error message saying that the variables were not declared.
 
I goofed in what I stated. When I tried to use the variables in my form, I
received an error message saying that the variables were not declared.

If you added a Module to you app, added the variables and it looks like:

Module Module1

Public strConn As String
Public strSQL As String

End Module

There is no reason that I can think of that "not declared' would show other than typo's.

Gene
 
Hello gene,

It could be possible that the module is in a different namespace than the
code which is trying to use it.
If this is so, add the proper Imports.

-Boo
 
It could be possible that the module is in a different namespace than the
code which is trying to use it.
If this is so, add the proper Imports.

-Boo


i would like to add to this , that you can test this easily as a module
behaves as a class with all members declared as shared

see if you can see the members with the modulename like this
modulename.strConn

regards

Michel Posseth
 
Back
Top