|
-
Mar 21st, 2008, 04:39 PM
#1
Thread Starter
Hyperactive Member
[2008] MDI and Child Forms
In VB6, MDI applications were possible. You'd create a form and a few Child forms and go with it.
I'm pretty sure this is still a possibility in VB2008 but where is it?
-
Mar 21st, 2008, 06:24 PM
#2
Re: [2008] MDI and Child Forms
You have to create an MDI Parent form and one or several MDI Child forms.
You can create an MDI Parent form by setting your form's "IsMdiContainer" property to True.
Alternatively, you can create a new mdi parent form complete with menubar and toolbar with default options (new/open/save, cut/copy/paste etc etc) by selecting a "MDI Parent Form" from the "Add New Item" dialog box (when you choose "Add - New Item" to add a new form).
An MDI Child form is a normal form like every other. The difference is in the way you show it.
In the MDI Parent form, you have to set the form's "MdiParent" property to your parent form.
For example, this code goes in the parent form, and the mdi child form is called "Form1":
vb.net Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Form1.MdiParent = Me Form1.Show() End Sub
-
Mar 22nd, 2008, 04:53 AM
#3
Member
Re: [2008] MDI and Child Forms
-
Mar 22nd, 2008, 09:00 AM
#4
Re: [2008] MDI and Child Forms
 Originally Posted by DroopyPawn
In VB6, MDI applications were possible. You'd create a form and a few Child forms and go with it.
I'm pretty sure this is still a possibility in VB2008 but where is it?
Hi,
Here's the explaination how to create a MDI form with VB 2008 also how to create Childforms.
http://msdn2.microsoft.com/en-us/library/d4dabts7.aspx
Hope it helps,
sparrow1
-
Mar 22nd, 2008, 09:36 AM
#5
Thread Starter
Hyperactive Member
Re: [2008] MDI and Child Forms
I found some pretty good info in the VB2008 help last night. Thanks for responding.
-
Dec 17th, 2010, 10:55 AM
#6
PowerPoster
Re: [2008] MDI and Child Forms
OK, I'm an idiot. But, implementing MDI in VS2008 is not nearly as easy as it was in VB6.
Code:
Private Sub MDIParent1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim LoginForm As New LoginForm1
LoginForm.Show()
End Sub
I have the MDI form all set up as a MDI Parent. On form load, I want the login screen to show (in the MDI form). The MDI form shows, but no login screen in it.
I have been Googling and looking at a VB2005 book that I have and it still does not make sense to me.
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Dec 17th, 2010, 11:04 AM
#7
PowerPoster
Re: [2008] MDI and Child Forms
OK, I changed the MDI Parent form load to this:
Code:
Private Sub MDIParent1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LoginForm1.Parent = Me
LoginForm1.Show()
End Sub
Now I get the error "A top level control cannot be added to a control"
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Dec 17th, 2010, 11:09 AM
#8
PowerPoster
Re: [2008] MDI and Child Forms
OK. got it. I needed to set the MDIParent not Parent
===================================================
If your question has been answered, mark the thread as [RESOLVED]
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
|