Hey guys.... Just wondered if anyone can help me, I'm busy writing an application with a login form using SQL Server, if the user logs into the specific for i want a lable saying logged in as : .... But how do you code that part?
Hope you understand

6 Years
Discussion Span
Last Post by SyncMaster170

I'm not sure I understand the difficulty. You already have the login credentials and know if they were legit or not, so it should be trivial to toss the user name into a label:

labelLoggedIn.Text = _authenticated ? "Logged In As: " + userName : "Not Logged In";

Edited by deceptikon


This is a shot in the dark as you have not specified any code that you are using to validate the users login credentials, but under the method in which your code validates the users credentials(username and password) simply set the label1.Text = usernameTextBox.Text.

So after the validating is complete and the user is logged in(I am talking about in your code) you should have a statement after your validating code executed that assigns your label1.Text to your usernameTextBox.Text.

Hope this helps.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.