How to pass data between 2 different window forms in the same project in visual c#? :)
Help please
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
theLizardPosted Nov 29, 2009, 3:15 AM
class mydata
{
string name;
string address;
int number
}
in form1 assign myData members
myData m = new myData();
myData.name = "myName";
myData.address = "myAddress";
myData.number = 1234;
then create a function in form2
showMyData(myData m)
{
TextBox1.Text = m.myName;
TextBox2.Text = m.myAddress;
TextBox3.Text = m.number.ToString();
}
in form1 send the data to form2 form2.showMyData(m)
THIS IS NOT ACTUAL CODE you will need to work out how to do it in c# your self...
Kirtan PatelPosted Nov 28, 2009, 11:29 PM
You can Do this By 4 Different Ways
Check out this article
http://www.c-sharpcorner.com/UploadFile/thiagu304/passdata05172006234318PM/passdata.aspx
if you find this useful then check "do you like this answer" check box please :)
huangPosted Nov 28, 2009, 10:29 PM