Results 1 to 4 of 4

Thread: [RESOLVED] Minimize all forms when main form is minimized

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    93

    Resolved [RESOLVED] Minimize all forms when main form is minimized

    I want to know how to minimize all open forms when i minimize the main form of my project. When there are a couple of forms visible, and i minimize the main form the others stay open. How can i minimize all the forms?

  2. #2
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Minimize all forms when main form is minimized

    Put this inside your main form:
    VB Code:
    1. Private Sub Form_Resize()
    2.     If Me.WindowState = vbMinimized Then
    3.         Dim frm As Form
    4.         For Each frm In Forms
    5.             If frm.Name <> Me.Name Then
    6.                 frm.WindowState = vbMinimized
    7.             End If
    8.         Next
    9.     End If
    10. End Sub
    If it is possible, use a MDIform and load other forms as MDIChild. It will solve you from this problem.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Minimize all forms when main form is minimized

    In your main form.

    VB Code:
    1. Private Sub Form_Resize()
    2.    Dim f As Form
    3.    If Me.WindowState = vbMinimized Then
    4.       For Each f In Forms
    5.         If Not (f Is Me) Then
    6.             f.WindowState = vbMinimized
    7.         End If
    8.       Next
    9.    End If
    10. End Sub

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    93

    Re: Minimize all forms when main form is minimized

    thanks, works great!

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