Dipika
Dipika

Reputation: 409

How to store username to use whole application

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

Answers (4)

Dipika
Dipika

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

sabikp
sabikp

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

Sudhakar Tillapudi
Sudhakar Tillapudi

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

sdrzymala
sdrzymala

Reputation: 387

Please read and use Application Settings file or Resource files.

Upvotes: 0

Related Questions