How to make public variables in VB6?

Dishdog

Fully Optimized
Messages
2,801
How,lol?

incase i'm not saying the right thing:
How to make a variable go across/be used in multiply forms.
 
One way to do it is to create a seperate MODULE file and then when declaring each variable just do :

Global varName as Type

That way all your variables are easy to keep track of.
 
Thanks, i knew it was simple but i couldn't remember how to,lol.

Having a little trouble, by module you mean form right?

Also it's not letting me make an variable array in a global statment.
 
Ok the Global/public variable array both work in a module.

now is there anyway i can set the values of the variables in the module? You can't set values in general and thats all it has, is there some code i can enter so i can set the values and change them in the module.

I tried putting it in a class module but it gives me the error that i can't have a variable array public in an object module(same one as before).
 
Ok i figured out how, i don't have the code on me now but i will post it later so other people can see how. Thanks for all the help.

Code:
Public Function "Name"()

end function

Then you just call the code up with:
Call "Name"

<EDIT> Do not use any of the quotes, just there to show where to put the name of the function.
 
Back
Top Bottom