Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have an MDI app and here's what I'm trying to do. I have a "search" form (we'll call it Form1 and the MDI Parent we'll 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 can't 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...)

 

'Display the work order in the work order form
       Dim main As frmMain
       wo.MdiParent = main
       wo.Show()

Being smarter than you look is always better than looking smarter than you are.
  • *Experts*
Posted

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.

Posted

Why don't 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

Fat kids are harder to kidnap
Posted

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.

The one and only

Dr. Madz

eee-m@il

Posted

Got it...

 

iebidan's method worked great! Here's what I finally came up with...

 

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

 

A thousand thank yous to all

Being smarter than you look is always better than looking smarter than you are.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...