|
-
Jul 24th, 2007, 07:57 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED]Help Newbie in MDI form
Currently i'm trying to design a maintenance system required vb.net platform.
However, i'm new of vb.net. I faced some problem that was different with vb6.Now i was added a mdiform, but i couldn't display child form at the front most of page. it is mdiform cannot add in any label and treeview? because i plan to use treeview as my menu.
thanks for any senior and professional vb.net programmer to give me a help
Last edited by nUflAvOrS; Jul 25th, 2007 at 06:17 AM.
Reason: RESOLVED
-
Jul 24th, 2007, 10:32 PM
#2
Re: Help Newbie in MDI form
You problem is somewhat vague or under-defined. Let's start with a few of the basics of MDI and see if that helps you understand a little better.
MDI stands for Multiple Document Interface. Essentially, you start with a main form, or a form that you wish to show other forms within. The main form is known as the MdiContainer or the MdiParent. You have to start by setting the IsMdiContainer property of the form to TRUE. This adds an MdiContainer control to your form that is docked in Fill mode. It is this container that houses the other forms that you wish to show.
As I mentioned, your main form is known as the MdiParent. Forms that are displayed within the MdiParent are known as the MdiChildren. Lets use an example that creates two forms, Form1 and Form2. Form1 will be our main form with the IsMdiContainer property set to TRUE. You can display Form2 within Form1 using similar code to this:
vb Code:
Public Class Form1
Public Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' This code creates and displays Form2
Dim myForm2 As New Form2
myForm2.MdiParent = Me
myForm2.Show()
myForm2.Dock = DockStyle.Fill
End Sub
End Class
Now, if your MdiContainer already contains an open MdiChild, then you can either leave the child open and set it's visible property to FALSE, or you can close all open MdiChildren. Let's modify the example code above to close all MdiChildren before opening another form, we'll say Form3:
vb Code:
Public Class Form1
Public Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' This code creates and displays Form2
Dim myForm2 As New Form2
myForm2.MdiParent = Me
myForm2.Show()
myForm2.Dock = DockStyle.Fill
End Sub
Public Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
' This code will close the MdiChild Form2
For Each frm As Form In Me.MdiChildren
frm.Close()
Next
' This code creates and displays Form3
Dim myForm3 As New Form3
myForm3.MdiParent = Me
myForm3.Show()
myForm3.Dock = DockStyle.Fill
End Sub
End Class
-
Jul 25th, 2007, 01:02 AM
#3
Thread Starter
Hyperactive Member
Re: Help Newbie in MDI form
-
Jul 25th, 2007, 02:38 AM
#4
Re: Help Newbie in MDI form
Hi,
I think your problem is that you need to split your Main Menu Page form first.
Put your Treeview in the Left part the Childforms will be showing in the Right part of your main menu page form.
Wkr,
sparrow1
-
Jul 25th, 2007, 03:00 AM
#5
Thread Starter
Hyperactive Member
Re: Help Newbie in MDI form
Thanks sparrow1,
Do you mean that set up the loadlocation of the childform that do not touch the margin of treeview.
Note: Treeview is attaching on parent mdiform.
-
Jul 25th, 2007, 03:06 AM
#6
Re: Help Newbie in MDI form
 Originally Posted by nUflAvOrS
Thanks sparrow1,
Do you mean that set up the loadlocation of the childform that do not touch the margin of treeview.
Note: Treeview is attaching on parent mdiform.
Hi,
That means that both will load properly without covering each other.
You doesn't need to set Topmost for your childforms.
Wkr,
sparrow1
-
Jul 25th, 2007, 03:15 AM
#7
Thread Starter
Hyperactive Member
Re: Help Newbie in MDI form
Thanks Sparrow1,
i think that I catch up your meaning.
Help me to interpret if it ;-)
add 1 more childform for attaching treeview as the menu
Furthermore, may i know the method to ensure merely one childform loaded when calling out the same form.
Thanks "-)
-
Jul 25th, 2007, 04:58 AM
#8
Re: Help Newbie in MDI form
 Originally Posted by nUflAvOrS
Thanks Sparrow1,
i think that I catch up your meaning.
Help me to interpret if it ;-)
add 1 more childform for attaching treeview as the menu
Furthermore, may i know the method to ensure merely one childform loaded when calling out the same form.
Thanks "-)
Hi,
You doesn't need to add one more childform for attaching your treeview, place your treeview into the splitter and call then your childforms, who will be showing up in the container. Don't forget to set IsMDIContainer = true
Wkr,
sparrow1
-
Jul 25th, 2007, 05:07 AM
#9
Thread Starter
Hyperactive Member
Re: Help Newbie in MDI form
Well Sparrow1 !!
Thx u a lot.. u had solved my problem..
i will rate ur post :-)
thanks ur kindness
Can you help me again ?
May i know the method to ensure merely one childform loaded when calling out the same childform. "-)
Last edited by nUflAvOrS; Jul 25th, 2007 at 05:14 AM.
-
Jul 25th, 2007, 05:15 AM
#10
Re: Help Newbie in MDI form
 Originally Posted by nUflAvOrS
Well Sparrow1 !!
Thx u a lot.. u had solved my problem..
i will rate ur post :-)
thanks ur kindness
Hi,
No problem glad to help
Mark your thread as resolved!
Wkr,
sparrow1
-
Jul 25th, 2007, 07:43 AM
#11
Re: Help Newbie in MDI form
 Originally Posted by nUflAvOrS
Can you help me again ?
May i know the method to ensure merely one childform loaded when calling out the same childform. "-)
You can do something like this:
Code:
Dim cancelAction As Boolean = False
For Each frm As Form In Me.MdiChildren
If TypeOf frm Is Form3 Then
cancelAction = True
End If
Next
If Not cancelAction Then
' Code to create new form here
End If
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
|