|
-
Mar 4th, 2004, 01:22 PM
#1
Thread Starter
Hyperactive Member
Identify an MDIform in the Forms collection? [Resolved]
How can I identify an MDIform (parent) when I'm looping through the forms collection?
Here's the problem:
When I loop to find the child forms:
For each frm in Forms
If frm.MDIChild Then ...
The 2nd line there fails when it hits the MDI "parent" since it has no .MDIChild property to check!
So, what I'd like to do is something like:
For each frm in Forms
If "NOT an MDI parent form" then
If frm.MDIChild Then ...
Thanks, DaveBo
Last edited by DaveBo; Mar 4th, 2004 at 01:57 PM.
"The wise man doesn't know all the answers, but he knows where to find them."
VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15
-
Mar 4th, 2004, 01:43 PM
#2
Hyperactive Member
Use LinkTopic value
Code:
Private Sub Command1_Click()
Dim f As Form
For Each f In Forms
If InStr(1, f.LinkTopic, "MDI", vbTextCompare) = False Then
Unload f
End If
Next
End Sub
Set your LinkTopic to contain "MDI" so it is identified as the MDI parent and it will not close it
-
Mar 4th, 2004, 01:57 PM
#3
Thread Starter
Hyperactive Member
Excellent
Thanks. BTW it doesn't like the vbTextCompare,
that results in a "type mismatch"
"The wise man doesn't know all the answers, but he knows where to find them."
VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15
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
|