you can do it like this too:
Create a Property in Homeform
Like this
private string userName;
public string UserName
{
get { return userName; }
set { userName = value; }
}
then From loginForm
set the UserName Property of Homeform to the username that who is logged in
I mean by this
if (.....)
{
FrmHome sd = new FrmHome();
sd.UserName = textBox1.Text;
sd.Show();
}
then you will get the username of user who logged in to homefrom
If you wish to show the Username in a label Use this
private void FrmHome_Load(object sender, EventArgs e)
{
label1.Text = "Hai " + userName;
}
If you got answer by this...
Click Accept Solution button on top...