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
Passing value from one form to other
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Former memberPosted May 21, 2011, 12:07 AM EDT
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 Rehman46 pointsPosted May 21, 2011, 1:56 AM EDT