Hi everybody, Please can some body tell me how can i pass int value from one form to another in windows form application using c-sharp......................
Thanks in advance
Loading
Posted May 21, 2011, 4:07 AM
2) From the Form1, create instance of the FOrm2,and assign the value for the public property.
Form 1 Code :
private void button2_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.MyName = "From Form 1";
frm.ShowDialog();
}
Form 2 Code :
public string MyName
{
get;
set;
}
For this I have attached the sample project.
Another way,you can create a static class and assign the values into in Form1 . Then can access the values into form2.
Kindly let me know,still if you need any help.
Zeb RehmanPosted May 21, 2011, 5:56 AM