|
-
Oct 5th, 2002, 05:35 PM
#1
Thread Starter
Member
Calling a sub from a parent form
How can i call a sub from a parent form ?
-
Oct 5th, 2002, 05:58 PM
#2
what do you mean by parent form? you mean the MDI form stuff?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Oct 5th, 2002, 06:05 PM
#3
Thread Starter
Member
I have a main form that starts another form, and in this new form i would like to call a sub from the main form .
-
Oct 5th, 2002, 06:10 PM
#4
aah, I havent worked with delegates.
You can pass the sub in the main for as a delegate to the second form and then call it from the second form.
You could also pass the main form to the second form, which isnt a very good thing to do
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Oct 5th, 2002, 08:56 PM
#5
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.
-
Oct 30th, 2002, 05:21 AM
#6
Fanatic Member
hi
i have some thing similar to this but i have a public sub in all my forms how do i call from mdi....
calling sub of mdi child from the parent mdi..
in vb6 we do me.activeform.assign (assign is the public sub)
in vb.net....?
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
|