المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How to assign the text to toolstripstatus in runtime?



C# Programming
05-26-2009, 03:12 PM
Hello All,

I am Savitri Here. I am new to this forum and also to this ********. I am doing one application in C#. Now i have two forms called Mainform and LoginForm. After running we login form will come and after successful login will get mainform. I want to assign the entered user name to toolstripstautuslable of statusstrip which is in mainform.When i clicking login button then only i am setting new value for that status strip but it is not assigning. Please help me. Below is the part of code.
LoginForm.Cs

MainForm frm = new MainForm();
private void btnLogin_Click(object sender, EventArgs e)
{
string username,password;
username=txtUsr.Text.ToString();
password=txtPwd.Text.ToString();
if(username.Equals("xxxxxx") && password.Equals("xxxxxx"))
{
MessageBox.Show("SuccessFully Logged in");
frm.toolStripStatusLabel2.Text = txtUsr.Text;
frm.GetValues(username, password);//textBox1_TextChanged();
this.Visible=false;
}
else
{
MessageBox.Show("Not valid UserName and Password");
}

}

MainForm.cs
public void GetValues(string strUsr,string strPwd)
{
this.UsrNam=strUsr;
MessageBox.Show(UsrNam);
this.PasPwd=strPwd;
MessageBox.Show(PasPwd);
this.toolStripStatusLabel2.Text = UsrNam.ToString();
this.*******();
}

Please Give me hints. Help me.
Thanks in Advance.
Regards,
Savitri P