[Question] Global Variables [solved]

Posts 1–7 of 7 · Page 1 of 1
[Question] Global Variables [solved]
Sorry if this is a stupid question, just moving into VB from C++ today.

How do I get a variable to have Global scope in VB?
You put/declare it outside the of subs (subroutines) but inside the class.
Also you need to make it a public variable, otherwise the scope will be the class modifier visibility.
Like ..

Sub KILL
'Code
End Sub

or

Public Sub BLBAL
' BALABL
ENd Sub

or

Function BLABLA(Params..)
Msgbox(Params) ' or BALBALAB LA
End Function
etc..
Then call it like.. In a button for example:
BLABLA("HELO")

Then it will do ur function...blablaba...
Quote Originally Posted by Lyoto Machida View Post
Like ..

Sub KILL
'Code
End Sub

or

Public Sub BLBAL
' BALABL
ENd Sub

or

Function BLABLA(Params..)
Msgbox(Params) ' or BALBALAB LA
End Function
etc..
Then call it like.. In a button for example:
BLABLA("HELO")

Then it will do ur function...blablaba...
You really don't have any idea what he's asking about do you?
Code:
Public VariableName As <T> [= BlaBlaBla]
Code:
Public MyVariable As Integer = 10
I'm going to go right ahead and mark this as solved.
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us