Results 1 to 5 of 5

Thread: Counting the MDI child forms

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Wellington NZ
    Posts
    153
    any way to count the child forms in an MDI form?

    Any answers?

    Rohan

  2. #2
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722
    Try the Forms Collection

    r0ach™
    Don't forget to rate the post

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Wellington NZ
    Posts
    153

    Talking what do you mean

    Do you have any example code to show me?

  4. #4
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    Try this:

    Code:
    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)
    Hope this helps

  5. #5
    Guest
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width