Reputation: 409
My application in in windows form.
I want to store username and show on upper side of page in whole page.
I also want use this username in whole application like the session in Asp.net.
Upvotes: 1
Views: 1373
Reputation: 409
Store username in class. In Class:
public class clsdata;{puclic Static String username; }
In code: after successfully login
clasData objclass= new clasdata(); clsData.username= username.Text;
Upvotes: 0
Reputation: 49
create a Module which holds the username variable.
Try This:
Module FunctionModule
Public UserName As String '''Store and Retrieve user name anywhere
End Module
Upvotes: 0
Reputation: 26209
You need to create a static class which holds the username variable.
Try This:
public static class UtilityClass
{
public static string UserName {get;set;}
}
//access the username as below
string name = UtilityClass.UserName;
Upvotes: 3