How to pass data between 2 different window forms in the same project in visual c#? :)
Help please
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
huang3 reputationPosted Nov 28, 2009, 5:29 PM EST
Kirtan PatelRank #292 · 8.6K reputationPosted Nov 28, 2009, 6:29 PM EST
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 :)
theLizardRank #1,079 · 1.8K reputationPosted Nov 28, 2009, 10:15 PM EST
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...