Varun said:
Can anyone plz tell me how i could declare a global variable that is
available throughout all my forms in my application??
I am new to vb.net and need advise how to do this!
Presuming you mean throughout a single multi-form project, look up "shared"
in the help. You can declare a variable as public shared (outside any code
block), and it will be available to other code within your project. E.g.
Public shared myInt as Integer
From the help:
"The Shared keyword indicates that one or more declared programming elements
are shared. Shared elements are not associated with a specific instance of a
class or structure. You can access them by qualifying them either with the
class or structure name, or with the variable name of a specific instance of
the class or structure.
The Shared keyword is used in these contexts:
Dim Statement
Event Statement
Function Statement
Property Statement
Sub Statement "
There are other options which may be preferable, but this will get you the
access you seek.