Hi all,
I have a login form and ChangePassword form. I want to retrieve the value of username entered in the Login form at the time of logging.
I have created a property named as RetUserName as follows:
public partial class frmLogin : Form
{
private string UseNam;
public string RetUserName
{
get { return UseNam; }
set { UseNam = value;}
}
}
In the button click event i have written the following code so that the value of the property is set:
this.RetUserName = (string)txtUserName.Text;
Now to retrieve the value of the property i have used the following coding in the form_load event of the changepassword form:
Form_Load Event:
frmLogin objLogin = new frmLogin();
string UserName1 = objLogin.RetUserName;
MessageBox.Show("NAME : " + UserName1);
txtUserName.Text = UserName1;
Now when I execute the above program does not generate any errors, however the value entered by the user in the login form is not displayed in the changepassword form.
Can anyone let me know how should I change the coding so that I can retrieve the values entered by user in the login form to be displayed in the changepassword form?
Please help me! Thanks in advance!