Hi
From FormA I am opening another form FormB using ShowDialog(). Is there a
way to access a text field on FormA (calling form) from FormB (called form)?
Thanks
Regards
Simplest way I can think is to use the overload on ShowDialog() and
pass in the calling form as the owner. Then, from the called form, you
can access any public member on the calling form like so:
///////////
Dim owner = TryCast(Owner, Form1)
If owner IsNot Nothing Then
'// Do something cool with the form
End If
///////////
However, I would prefer that you do something along the lines of
constructor injection, feeding whatever the called form needs into the
constructor, and preventing the need for the above backreferencing
(not to mention it decouples the called form from the calling form).
Thanks,
Seth Rowe [MVP]
http://sethrowe.blogspot.com/