|
-
Apr 18th, 2003, 02:30 AM
#1
Thread Starter
Registered User
Call a Form from MDI Window? [Resolved]
How can i call a Form from a MDI Window?
How can i set a Form as a child of a MDI Window?
"Form1.Show" works in VB 6.0, now does not work in VB .NET.
Any solution VB .NET to show a Form?
Please guide. 10q!
Last edited by albertlse; Aug 21st, 2003 at 08:05 PM.
-
Apr 18th, 2003, 02:47 AM
#2
Sleep mode
Re: Call a Form from MDI Window?
To show a form do this :
VB Code:
dim myform as new yourform
myform.show
-
Apr 18th, 2003, 03:31 AM
#3
Sleep mode
To create new child form just call this little sub .
VB Code:
Private Sub NewChild()
Dim fc As New YourChildform()
fc.MdiParent = Me
fc.Show()
End Sub
-
Apr 18th, 2003, 03:46 AM
#4
Thread Starter
Registered User
In my case, I try to open Form1 from mdiForm.
This is how i wrote in mdiForm:
Private Sub mnuFileNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileNew.Click
Dim frmNewEntry As frmEntry
frmNewEntry.Show()
End Sub
Is this correct?
But why the error message below keep on occur?
"System.NullReferenceException: Object reference not set to an instance of an object."
Please guide. Thank you.
-
Apr 18th, 2003, 05:12 AM
#5
Sleep mode
Originally posted by albertlse
This is how i wrote in mdiForm:
Private Sub mnuFileNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileNew.Click
Dim frmNewEntry As frmEntry
frmNewEntry.Show()
End Sub
You need to create new(instaciate) object of frmEntry by using New keyword. You have to read more about OOP in .NET . So your code should look like so :
VB Code:
Private Sub mnuFileNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileNew.Click
Dim frmNewEntry As New frmEntry
frmNewEntry.Show()
End Sub
-
Apr 18th, 2003, 07:39 AM
#6
Fanatic Member
"System.NullReferenceException: Object reference not set to an instance of an object." is usually an indication that you did not use the "New" keyword to instantiate the object prior trying to use it.
-
Apr 18th, 2003, 10:37 AM
#7
Thread Starter
Registered User
It's working fine now! Thank you!
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
|