MDI Parent-Child woes...

Mothra

Well-known member
Joined
Nov 26, 2002
Messages
173
Location
Fresno, California
I have an MDI app and heres what Im trying to do. I have a "search" form (well call it Form1 and the MDI Parent well call frmMain...) which gets search criteria from the user and displays the results in a DataGrid. When the user double-clicks the desired row of the DataGrid, I have annother form (Form2) open that allows the user to edit the information from the record. My problem is that I cant seem to get the MDIParent property of Form2 to set correctly. It opens just fine but not as a child form of frmMain. Is it even possible to do this??

The following code is what I have in Form1 and it does NOT work:
(note: in the following code wo is declared as Form2 earlier on...)

Code:
 Display the work order in the work order form
        Dim main As frmMain
        wo.MdiParent = main
        wo.Show()
 
You need to pass the instance of you main form in constructors.
For example, when you call form1 edit its contructor to accept an instance of your main form. Then use the variable that holds the value when setting the parent of the next form.
 
Why dont you try Me.MdiParent to open the second form (Form2) for the MdiParent property from the first form (Form1), this works fine for me.

Regards
 
But some one told me about that "

FrmMDI.IsMDIContainer = TRUE
Client.MDIPARENT = SOMEFORM

there would be some memory leackage and this is not an appropriate method of displaying forms ? can any one explain it please about it.
 
Got it...

iebidans method worked great! Heres what I finally came up with...

Code:
        Display the work order form
        wo.MdiParent = Me.MdiParent
        wo.Show()

A thousand thank yous to all
 
Back
Top