Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing info between forms 1

Status
Not open for further replies.

mbutch

Programmer
Nov 17, 2000
100
US
When a user selects something on a form, I want to pop up a window with 4 text boxes that they can enter info into and click a button that sends the info back to the original form.

What is the best approach to take?

Thanks
 

Create the popup form with the four fields on it and an OK and Cancel button. Add four properties to the form to expose the values of the four text boxes.

Then in the main form you will create an instance of the popup, display it and then retrieve data from it when it is closed. It will look something like this in the main form.

MyPopupForm popup = new MyPopupForm();
popup.ShowDialog();

if (popup.DialogResult == DialogResult.OK)
{
// Get data from the popup form
this.txtOne = popup.FieldOne;
this.txtTwo = popup.FieldTwo;
// etc
}

 
Great, thanks. It works well. One last question. Can I keep the popup window from showing up in the task bar?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top