Can someone perhaps help me with a little problem I have on my database application.
When a user logs into my database with a User Name and Password, I want the User Name to be stored and accesible by the application as a whole (all forms etc), so that every action undertaken carries the users signature as it were.
I’m thinking the code is probably something like the following:
namespace YourNamespaceName
{
class Variables
{
public static string strUser = "user name";
}
}
Which I can recall then with Variables.strUser
However I don’t want to hard code the value of user name into my application. Rather I need it to be evaluated at runtime based on the initial log in procedure, and retain the user name for reference for the duration of the application running.
Thanking you all in anticipation of your assistance.
You didn’t specify framework version, but this code works with .NET 2.0. To use: