Reputation: 2901
I have no of forms in VB 6. I want to access the value of one variable throughout the application.
What is the way to create global variable in VB 6.
EDIT: I want to create only one global variable. I am new to VB,So Please give me some code snippet
Thanks.
Upvotes: 1
Views: 761
Reputation: 2309
create a module and declare the variable there. Actually,you dont need to specify the Public keyword,things in module are by default treated as Public
Dim var1 as string
Upvotes: 0
Reputation: 189555
Create a module file (a file with the extension .bas) and in the (Declarations) section place something like the following in it:-
Public MyVariable As String
Upvotes: 4