Mothra Posted May 28, 2003 Posted May 28, 2003 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() Quote Being smarter than you look is always better than looking smarter than you are.
*Experts* mutant Posted May 28, 2003 *Experts* Posted May 28, 2003 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. Quote
iebidan Posted May 28, 2003 Posted May 28, 2003 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 Quote Fat kids are harder to kidnap
*Experts* mutant Posted May 28, 2003 *Experts* Posted May 28, 2003 Yes :) Use what iebidan said :) I didnt think about that :rolleyes: Quote
Madz Posted May 29, 2003 Posted May 29, 2003 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. Quote The one and only Dr. Madz eee-m@il
*Gurus* divil Posted May 29, 2003 *Gurus* Posted May 29, 2003 That looks like the correct way to implement mdi forms. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Mothra Posted May 29, 2003 Author Posted May 29, 2003 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 Quote Being smarter than you look is always better than looking smarter than you are.
iebidan Posted May 29, 2003 Posted May 29, 2003 I'm glad that finally I helped someone :) Quote Fat kids are harder to kidnap
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.