Ask the Expert

Creating a relationship between control values in two forms

How can I create a relationship between control values in two forms, such as get the combobox.selectedindex from form1 to the textbox.text in form2? If possible, how would you recommend I approach this issue?
It depends on the relationship between the two forms. If form 1 created form 2 then I would use a property on form 2 and set the property before showing the form.

It form 1 and form 2 are created as independent forms, I would use a delegate (event handler) so when form 2 wanted the value from form 1, it could fire an event on form 1 to retrieve the data and/or an event on form 2 could be fired by form 1 when the value changed.

This was first published in December 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: