How to open a form From a closing One

  • Thread starter Thread starter TCORDON
  • Start date Start date
T

TCORDON

I have an MDI application, I need to open an MDIChild whern another one
closes. How should I handle this. How do I assign the parent form?

If I use:

Sub Button1_Click()
dim MyNewForm as New Form2
MyNewForm.MDIParent=frmMDI ?
MyNewForm.Show
me.close
End Sub

This will not work because when the form closes it destroys MyNewForm

Thanks
 
Hi,

You're close - the trick is to call me close AFTER calling the other child,
assigning the parent BEFORE doing so:
dim MyNewForm as New Form2
MyNewForm.MDIParent = me.parent
MyNewForm.Show
me.close

HTH,

Bernie Yaeger
 
Have the child call a public method in the parent to trigger the new
form or (better) have the parent listent to the child's closing method
and act by itself...

Sam
 
Hi,

Actually, do the me.close immediately before the mynewform.show:
Sub Button1_Click()
dim MyNewForm as New Form2
MyNewForm.MDIParent = me.parent
me.close
MyNewForm.Show
End Sub

Bernie
 
TCORDON said:
I have an MDI application, I need to open an MDIChild whern another one
closes. How should I handle this. How do I assign the parent form?

If I use:

Sub Button1_Click()
dim MyNewForm as New Form2

\\\
MyNewForm.MdiParent = Me.MdiParent
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top