|
-
Oct 16th, 2006, 10:12 AM
#1
Thread Starter
Member
Help with modules and scope
With VS2005 I have in my main Form1 class
Public FSInterface As New FSDataClass.
If I add a module how can I let the module see this FSInterface object please?
Also in a module, with VS6 I could define 'global test as integer' and all forms etc could see that variable, I cant do that in VS2005. Any variables I put into the module are not seen elsewhere.
I would like to keep a lot of my variables in a module or similar. Any advice on that please?
Thanks
Graham
Last edited by gjpollitt; Oct 16th, 2006 at 10:49 AM.
-
Oct 16th, 2006, 10:55 AM
#2
Fanatic Member
Re: Help with modules and scope
-
Oct 16th, 2006, 10:56 AM
#3
Fanatic Member
Re: Help with modules and scope
Also you need to declare your public variable outside your Sub Main.
-
Oct 16th, 2006, 11:25 AM
#4
Re: Help with modules and scope
A module itself has scope. If you havent set it specifically, it should be Public (the replacement for Global).
So this code:
VB Code:
Module MyModule
Public MyVariable As String
End Module
should be seen from anywhere.
As for accessing the form, you need to access an instance of an object, its a common question and should be in the FAQ at the top of this forum.
Dont forget that an Integer in .Net is what a Long was in VB6. If you want to use the VB6 Integer (you probly dont) its called a Short.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|