how can i access a variable of one form to another using property.
I have modified this question............
i have a login form and then i created one sign in form for employee.
then i wrote two properties to access the username and id from the login form to the sign in form.
public string getUname
{
get
{
return this.uname;
}
set
{
this.uname = value;
}
}
#endregion
#region // getUserid
public string getUserid
{
get
{
return this.Userid;
}
set
{
this.Userid = value;
}
}
actually it worked.
following code on login page to assign values to property
SignIn signin = new SignIn();
signin.getUname = username;
signin.getUserid = id;
but then i added a MDI form within them means i opened MDI with correct login and then from MDI i am opening a sign in form and passing those variable values to database to check.
code on mdi form
private void MDI_EmployeeAttendance_Load(object sender, EventArgs e)
{
Login frmlogin = new Login();
SignIn signin = new SignIn();
uname = signin.getUname;
uid = signin.getUserid;
OR
uname=frmlogin.username;
uid=frmlogin.id;
}
but now the properties i have been written on sign in page are not getting the values from the login page. so what might be the problem i dont found after debugging. when i assign values from login form to property it assigns to it but when sign in form opens the property variables are null. so please help me...