Passing handles of one form to another
-
Hi, I have a principal class with properties and a GUI form. The menu on the form allows the user to pull-up a second form to input property values. How can I transfer the property values (text-box inputs) from the second form to the properties of the first class. I've tried from the principal class (in menu-event code) Form_params fp = new Form_params(); fp.ShowDialog(this); so I pass 'this' to the next class. Is this right and how do I access the handle in the second class? Thanks, -Jay
-
Hi, I have a principal class with properties and a GUI form. The menu on the form allows the user to pull-up a second form to input property values. How can I transfer the property values (text-box inputs) from the second form to the properties of the first class. I've tried from the principal class (in menu-event code) Form_params fp = new Form_params(); fp.ShowDialog(this); so I pass 'this' to the next class. Is this right and how do I access the handle in the second class? Thanks, -Jay
Your description is confusing to say the least. Are you saying the you want to show a second form that has a bunch of TextBoxs and you want to apply the values of these TextBox to the properties of your first Form??? Easy enough. Expose the vluaes of the TextBox's as Public Properties on your second form. Get the values using these property accessors and assign them to the properties of your form.
Form2 f2 = new Form2();
f2.ShowDialog();
this.Text = f2.TextValue;//Form2
public class Form2 : blah
{
public string TextValue
{
get
{
return this.TextBox3.Text;
}
}
}Form Handles will have nothing to do with this at all.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome-- modified at 11:14 Tuesday 7th February, 2006
-
Hi, I have a principal class with properties and a GUI form. The menu on the form allows the user to pull-up a second form to input property values. How can I transfer the property values (text-box inputs) from the second form to the properties of the first class. I've tried from the principal class (in menu-event code) Form_params fp = new Form_params(); fp.ShowDialog(this); so I pass 'this' to the next class. Is this right and how do I access the handle in the second class? Thanks, -Jay
I guess you are wondering how to access the "this" Form_params( Form1 form) { // this refer to the form 1 now ........... }