This is Pretty Easy enough.
Create a Singleton class like this
public class LoggedInfo
{
static LoggedInfo instance = null;
public string UserId { get; set; }
public string UserName { get; set; }
static readonly object padlock = new object();
LoggedInfo()
{
}
public static LoggedInfo Instance
{
get
{
lock (padlock)
{
if (instance == null)
{
instance = new LoggedInfo();
}
return instance;
}
}
}
}
You might set this property from your login form like this
LoggedInfo li = LoggedInfo.Instance;
li.UserId = this.textBox1.Text;
And from any form in your project you might get the value of this property like this,
string userId=LoggedInfo.Instance.UserId;