Close all MDI Child except me
![Visual Basic 6, or VB Classic Visual Basic 6, or VB Classic](https://www.fortypoundhead.com//assets/img/icons/v7/vb6.png)
This code will close all other MDI Child except the current activated one.Simply put this procedure in Module or Form itself..There are two different way to use it.
Original Author: Mihir Solanki
Code
Option Explicit
'+++++++++++++++++++++++++++++++++++++
' First Style
' Use private procedure in Form
'+++++++++++++++++++++++++++++++++++++
Private Sub Form_Activate()
UnloadOthers
End Sub
Private Sub UnloadOthers()
Dim frm As Form
For Each frm In Forms
If frm.Name <> Me.Name And Not (TypeOf frm Is MDIForm) Then
Unload frm
End If
Next
End Sub
'+++++++++++++++++++++++++++++++++++++
' Second Style
' Use Public Procedure in Module
'+++++++++++++++++++++++++++++++++++++
'Form Code
Private Sub Form_Activate()
UnloadOthers me.Name
End Sub
'Module Code
Public Sub UnloadOthers(frmName as string)
Dim frm As Form
For Each frm In Forms
If frm.Name <> frmName And Not (TypeOf frm Is MDIForm) Then
Unload frm
End If
Next
End Sub
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.