variables for all forms

JonathanW

New member
Joined
Feb 12, 2007
Messages
2
Programming Experience
Beginner
could somebody tell me how I declare a variables that all forms in my project can recognize and use? thanks
 
Add a new class to your project. Call it globals or something. Mark the varaible you want with the 'Friend Shared' modifier and there you go. To use it..


VB.NET:
Globals.YourVariable
 
ok so I made a new class called variables, and in that i wrote

Dim username1 As String

then how do i mark that with the "friend shared" modifier?

then to use it in any form i would write globals.username1 = text1.text ??

sorry i'm a real beginner
 
VB.NET:
Friend Shared UserName1 As String

Your class is called variables so any members marked Shared can be accessed using the class name and then the member.

VB.NET:
Variables.Username1 = ..
 
Back
Top