|
-
Oct 5th, 2002, 08:56 PM
#1
Hyperactive Member
Pass a reference of the main form to the second form by modifying sub new in the second form:-
'second form
'declare a private variable as whatever main form is called
Private _MainForm as form1
Public Sub New(Mainform as form1)
_MainForm = MainForm
MyBase.New()
End Sub
'main form
'pass the reference to the main form
dim SecondForm as new form2(me)
SecondForm.Show()
Now in the second form you can call any public method :-
_MainForm.DoSomething
You can have as many versions of the New procedure as you want as long as they have different signitures (like any method) so you could have New procedures that accept any object you need to pass to it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|