Link to home
Start Free TrialLog in
Avatar of prakash_prk
prakash_prkFlag for India

asked on

MDI child form display problem

Hi  friends

I have a typical problem in mdi child form.

I am having Three forms( One is Mdi parent(MDiParent)  and the other two are  child forms (Child1, Child2) )
------------------------------------------------
MDIParent Loads First
--
 Private Sub MDIParent_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i As New child2
        i.MdiParent = Me
        i.Show()
    End Sub
-----
 The form child2 having one button control
--------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As New child1
        i.MdiParent = Me.ParentForm
        i.Show
    End Sub
--------------

The form child1 properties.
--------------------------------
FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
ControlBox = false

 Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
        MsgBox("some text")
    End Sub

------------------------
while running..
After loading the MDIParent

when I click the Button1 on child2 , child1 loads. The messagebox displays. At the time look at the child form, Its Icon is Flying window and the control box are all appears

How fix the error...
Thank you .
Prakash
Avatar of EBatista
EBatista

hi prakash, that is not an error, that is a normal behaviour of mdi chils forms. ControlBox property has no effect on them, they have sizable borders, a control-menu box, and minimize and maximize buttons, regardless of the settings of the FormBorderStyle, ControlBox, MinimizeBox, and MaximizeBox.

regards
Elio
Avatar of prakash_prk

ASKER

Hi Ebatsita

Thank you for your comment.

      But I am having 20 images each of them 100k to display on the form . while loading the images the display above I am  mentioned appears .

 How to avoid this ??

regards
prakash

Avatar of Howard Cantrell
Try this....
 
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim objForm As New child1
        objForm.ShowDialog()
    End Sub
just dont set it as mdi child, you can achieve that by using the Owner property instead:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As New child1
        i.Owner= Me
        i.Show
    End Sub



Hi EBatista

Owned Forms !!! .Your method works. The Menu in the child form are not goto the MDIparent .

I want it in MDI Child forms.

regards
Pakash
Pakash, what do you actually want to achieve?

My form loads very slow because of the images . At the time for a few seconds (2)  the titlebar for child form & windows logo displayed.

How to prevent this ?

regards
prakash
do you want your mdi form without titlebar?
What u want to achieve can be done using a Parent Form and 2 Child Forms. Parent Form in your case should not be a MDI form. Create a normal form as the parent. Then call the child form from the parent using

Dim objForm As New child1
  objForm.ShowDialog()

Hi all

I want MDI Form with titlebar
Friends I have 20 forms in my project . There is only one form is mdi parent all other forms are MDI Child. All the child forms having some menu's.

hi 123654789987, your method works but it have little drawback the menu's in child form  doesn't goes to parent ..

regards
prakash
ASKER CERTIFIED SOLUTION
Avatar of EBatista
EBatista

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial