quick question ---- global variables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I wanted to create a variable that can be used as a flag throughout my application
Can anyone tell me how i can create this global varible. Im confused as to how these work I tried...

Public Shared MyVariable as Boolea

and i tried to us

Friend Shared myVariable as Boolea

I wrote these in form1 and then i tried accessing the variable in form2, however i got a message stating the varibale has not been declared. Can anyone please explain to me what im doin wrong??
Many thx
 
Hi,

Place it in a module instead of a form.

Module Module1

Public MyVariable as Boolean

End Module


Ken
 
Thx Ken

May i ask what the module is used for
Is it a store for all the globle variables and procuedures?
 
varun said:
I wanted to create a variable that can be used as a flag throughout my application.
Can anyone tell me how i can create this global varible. Im confused
as to how these work I tried....

Public Shared MyVariable as Boolean

and i tried to use

Friend Shared myVariable as Boolean

I wrote these in form1 and then i tried accessing the variable in
form2, however i got a message stating the varibale has not been
declared. Can anyone please explain to me what im doin wrong???

Well, you haven't shown how you tried to access the variable. You need
to tell VB.NET which class it's in, eg

Form1.MyVariable
 
Back
Top