yo_daz_uk
asked on
Forms - Editing Form text boxes from a class
All,
Vb.Net 2005.
Say i have 2 forms that both have a textbox called textbox1, how can i set to update this from a different class.
i was expecting something like .........
' Call from either for1 or form 2
editTheBox(me)
then in the different class ....
sub editTheBox(ByVal frm as windows.Forms.Form)
frm.TextBox1.text = "hello"
end sub
This (in hindsight) obviously did not work because it did not know what form to reference, and i became aware that the only way i could get this to work was to use something like .....
sub editTheBox(ByVal frm as Frm1)
frm.TextBox1.text = "hello"
end sub
The problem is this only works for form1 now, but i wanted it to be generic to work for form1 and form 2. (In the real app this will be referenced by 3 forms if i can get it working).
Any ideas, anyone ?
Thanks,
Daz
Vb.Net 2005.
Say i have 2 forms that both have a textbox called textbox1, how can i set to update this from a different class.
i was expecting something like .........
' Call from either for1 or form 2
editTheBox(me)
then in the different class ....
sub editTheBox(ByVal frm as windows.Forms.Form)
frm.TextBox1.text = "hello"
end sub
This (in hindsight) obviously did not work because it did not know what form to reference, and i became aware that the only way i could get this to work was to use something like .....
sub editTheBox(ByVal frm as Frm1)
frm.TextBox1.text = "hello"
end sub
The problem is this only works for form1 now, but i wanted it to be generic to work for form1 and form 2. (In the real app this will be referenced by 3 forms if i can get it working).
Any ideas, anyone ?
Thanks,
Daz
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER