|
-
Feb 7th, 2000, 08:22 AM
#1
Thread Starter
Hyperactive Member
I was wondering if there is a quick and easy way to unload all of my MDI Child forms.
------------------
Ryan
-
Feb 7th, 2000, 08:27 AM
#2
So Unbanned
You could make the forms an array then:
For x = 1 to 5
Unload MChild(x)
Next x
or make a sub
Public Sub UnloadM()
Unload Mchild
Unload Mchild2
Unload Mchild3
End Sub
------------------
DiGiTaIErRoR
VB, QBasic, Iptscrae, HTML
Quote: There are no stupid questions, just stupid people.
-
Feb 7th, 2000, 08:35 AM
#3
Thread Starter
Hyperactive Member
No, I don't want to make a function for it, because I only need it in one place. Thanks anyway. But one other question:
How can I check to see if a form is loaded? Because if I try to unload a form that is not loaded, then it will give me an error.
------------------
Ryan
-
Feb 7th, 2000, 11:55 AM
#4
Fanatic Member
I don't know if it helps, but if you know the name of this form then you could use this:
Code:
Public Function FormLoadedByName(FormName As String) As Boolean
Dim i As Integer, fnamelc As String
fnamelc = LCase$(FormName)
FormLoadedByName = False
For i = 0 To Forms.Count - 1
If LCase$(Forms(i).Name) = fnamelc Then
FormLoadedByName = True
Exit Function
End If
Next
End Function
Well it's not perfect but maybe you will be able to use it somehow.
HTH
------------------
Visual Basic Programmer
------------------
PolComSoft
You will hear a lot about it.
-
Feb 7th, 2000, 05:35 PM
#5
New Member
Actually, there is:
Code:
For Each Form In Forms
If Form.Name <> MDIForm.Name Then Unload Form
Next
The Forms collection only contains loaded forms. If all your forms (except for the MDIForm) are MDIChildren then this would work. Make sure you make "MDIForm" match the actual name of the form!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|