pass the value of three textbox from one form to another form for simple windows form application

Recommended Answers

All 2 Replies

I made this project to train my ability to pass values from one form to another.

well i'd recommend using delegates to pass values from one form to another form, as long as they are short, but if you need pass a lot more information, you can reference the form1 (the owner of the comunication) and then use the referenced object on the form2.

you can do it this way.

//lets supose you have an already defined form2 class

//here you pass the form1 or mainform by reference
Form2 form2=new Form2(this);


//and in your form2 you will have something like this

Form1 form1byreference;
//Constructor of the form2
public Form2(Form1 form1)
{
form1byreference=form1;
}

//and now you can obtain and even modify the form1 from the form2
//for example
form1byreference.Size=whatever you want;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.