any way to count the child forms in an MDI form?
Any answers?
Rohan
Printable View
any way to count the child forms in an MDI form?
Any answers?
Rohan
Try the Forms Collection
Do you have any example code to show me?
Try this:
Hope this helpsCode:Dim myform As Form
Dim count As Integer
For Each myform In Forms
If myform.Name <> "MDIForm1" Then
If myform.MDIChild = True Then
count = count + 1
End If
End If
Next
MsgBox (count)
This example is using the Forms Collection. Make an MDIForm with a PictureBox on it and Place this code into the Click Event of it. (Make sure you have another Form called Form1 and set the MDIChild property to True.
Code:Private Sub Picture1_Click()
Dim NewForm As Form1
Set NewForm = New Form1
NewForm.Show
MsgBox (Forms.Count - 1)
End Sub