Public definitions in module - VS 2005

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
 
G

gene kelley

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
 
H

Henry Jones

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.
 
G

gene kelley

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
 
G

GhostInAK

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
 
M

Michel Posseth [MCP]

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
 

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