Click here to Skip to main content
15,894,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I would like to know, as to how i can diplay a users name once they have logged on to a application?

If they logged on with their username and password correctly, then on the next form their name should display.

Please let me know what i can do.

Thanks
Posted
Updated 26-Oct-12 4:27am
v2
Comments
Rahul K Singh 26-Oct-12 5:39am    
are u talking about desktop application or Web application?

First create a user class something like below,
C#
public class UserProfile
{
  public string UserName {get;set;};
  .........................
}


then on successful login,just create one static user object like ,

static UserProfile userProfile=new UserProfile(); and assign the username

userProfile.UserName="XYZ";

then you can access that object in any form in your application(in your case on next form).

lblUsername.Text=UserProfile.UserName;
 
Share this answer
 
v3
Comments
Dartswift00 26-Oct-12 9:58am    
Hi Rajkumar_n,
I did do a similar idea to what you have mentioned, but i notice that once i have logged in, the application that i used to access(Username and password) the other application is minimized, which i dont want.

How can i make it not do that?
Store the username in a string after successful login. Then fetch the corresponding name for the username or disply the username directly.
 
Share this answer
 
v2
This is a Windows application , not web application.

Membership controls ? how does that work an example please.
As far as sessions goes, i know it's used in asp.net stuff not in vb.net...
 
Share this answer
 
Use session or membership controls.

Thanks,
Ambesha
 
Share this answer
 
Hello , i made an example for you , application's bank is Access :

UserName : siavash
Password : 123

Download Example[^]
 
Share this answer
 
Comments
Dartswift00 30-Oct-12 7:43am    
Hi siavash,
thanks for download, but forgt to mention, i am using .NET 3.5 not .NET4

If you can send me a 3.5.NET coding that will really help

Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900