Hi,
Does anyone know how to declare global variables, which are available in the whole project(all the forms).
Please send some code example, if possible.
Thanx,
Maarten
Printable View
Hi,
Does anyone know how to declare global variables, which are available in the whole project(all the forms).
Please send some code example, if possible.
Thanx,
Maarten
Add a BAS module to your project (called modGlobals.BAS for example), then you can add global variables there, eg :
public g_SomeGlobalString as string
public Const SOME_CONSTANT as string = "Some string That Doesnt Change"
public Const SECONDS_IN_AN_HOUR as Long = 60 * 60
In Form1 - form_load procedure :
MsgBox SOME_CONSTANT
g_SomeGlobalString = "Something else"
MsgBox g_SomeGlobalString
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
This one works also like I wanted.
Thanx!