-----------------------------------------------------------
New Message on cochindotnet
-----------------------------------------------------------
From: mathai
Message 2 in Discussion
Suppose your forms are Form1 and Form2 and that you are creating a new instance of
Form2 named f2 from your Form1 instance. To access the first form you have to have a
reference to it in the second form. If you are using ShowDialog to display f2, you
can pass the first form as an argument and the owner property of f2 can be cast into
form1 to access it
Dim f2 As New Form2
f2.ShowDialog(Me) 'Me is the first form Then from f2 whenever you
want to access the first form use
Ctype(f2.Owner,Form1) Another way is to define a new constructor in form2(or
change the default constructor) as follows private _form1 as Form1 public
sub New(byval f as Form1)
New 'Call if you have defined this as a second constructor
_form1=f
end sub
you can use _form1 to access objects in the first form. And in the first
form use
Dim f2 as new Form2(Me) Instead of a constructor you can define a method which
accepts the first form as an argument private _form1 as Form1 public sub
SetParent(byval f as Form1)
_form1=f
end sub
And in the first form use
Dim f2 as new Form2()
f2.SetParent(Me)
f2.Show() Hope this helps
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/cochindotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]