How can i set a value of a global variable declared on Form1 from Form2? :)
Printable View
How can i set a value of a global variable declared on Form1 from Form2? :)
Code:Form1.MyGlobalVarible = Whatever
It doesn work :(
How must the variable be declared?
I got an error saying Method or data member not found
You have to declare as a DIM
DIM myVariableName as String (shared with other forms tooo)
and use
Public myVariableName as String (needs to be in a MODULE)
Private myVariableName as String (shared with the current form only)
Declare the global variable in a module with this command at the top of your code below the "Option Explicit"
Global MyValue as Integer
You can declare a public variable in a form, and call it from another form.Code:'on form1
Option Explicit
Public strString As String
'on form2
Private Sub Form_Load()
Form1.strString = "Hack"
End Sub
thanx guys, it works now :)