Unloading MDI Child Forms 
Author Message
 Unloading MDI Child Forms

Hello all,

Any ideas on how to unload a MDI Child form at run
time?  'Unload MDIChildFormName' doesn't seem to work.

Thanks,

Len



Sun, 28 Dec 2003 02:42:07 GMT  
 Unloading MDI Child Forms
Hi Len:

Quote:
> Any ideas on how to unload a MDI Child form at run
> time?  'Unload MDIChildFormName' doesn't seem to work.

I suspect that you are loading *instances* of the child form? i.e.

Dim frm As frmChild
Set frm = New frmChild
frm.Show

If so, then you would need to unload that instance, i.e

  Unload frm

If the instance variable has gone out of scope, then you could access the form via the Forms collection, i.e.

Dim frm As Form
For Each frm In Forms
   If TypeOf frm Is frmChild Then
      Unload frm
   End If
Next frm

Note: the above doesn't cover all scenarios -- just a push to get you started.

Hope this helps,

Doug.



Sun, 28 Dec 2003 03:26:46 GMT  
 Unloading MDI Child Forms
Where are you calling the unload from?  I just tried it
and it seemed to work fine.

Although, if you have an open form that has the MDIChild
property set to false, unloading the Mdi form will not
unload it automatically.

'************************************
'From within the MDI Form
Private Sub mnuFileItemExit_Click()
    Unload Me
End Sub
'************************************
'From a child form
Private Sub Command1_Click()
    Unload MDIForm1
End Sub
'************************************

Quote:
>-----Original Message-----
>Hello all,

>Any ideas on how to unload a MDI Child form at run
>time?  'Unload MDIChildFormName' doesn't seem to work.

>Thanks,

>Len
>.



Sun, 28 Dec 2003 03:45:54 GMT  
 Unloading MDI Child Forms
Thank you, this worked.

Quote:
>-----Original Message-----
>Hi Len:

>> Any ideas on how to unload a MDI Child form at run
>> time?  'Unload MDIChildFormName' doesn't seem to work.

>I suspect that you are loading *instances* of the child
form? i.e.

>Dim frm As frmChild
>Set frm = New frmChild
>frm.Show

>If so, then you would need to unload that instance, i.e

>  Unload frm

>If the instance variable has gone out of scope, then you

could access the form via the Forms collection, i.e.
Quote:

>Dim frm As Form
>For Each frm In Forms
>   If TypeOf frm Is frmChild Then
>      Unload frm
>   End If
>Next frm

>Note: the above doesn't cover all scenarios -- just a

push to get you started.

- Show quoted text -

Quote:

>Hope this helps,

>Doug.

>.



Sun, 28 Dec 2003 23:21:30 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Unload MDI Child forms

2. Unloading MDI Child Forms

3. Q: Form activate Fires On Non Child MDI Forms But Only Once On Child Mdi Forms

4. MDI Help - Prevent Child Form from Exiting in Unload Event

5. GPF in Krnl386.exe crashes VB5 IDE on unload of MDI child form

6. MDI Help - Prevent Child Form from Exiting in Unload Event

7. Modifying object in MDI Parent form from MDI Child form

8. Make a reference to a MDI form with a reference of a MDI child form

9. MDI-Child form and positon on MDI-form

10. Developing OLE MDI Child forms displayed on Control MDI Form

11. MDI child forms on top of a picture on a MDI form

12. Help with MDI Forms and MDI child forms

 

 
Powered by phpBB® Forum Software