how unload all forms at the same time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yoda
    Contributor
    • Dec 2006
    • 291

    #1

    how unload all forms at the same time

    how unload all forms at the same time or hide all at the same time

    thanks for the for who ever does

    Yoda (canada eh)
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Originally posted by yoda
    how unload all forms at the same time or hide all at the same time

    thanks for the for who ever does

    Yoda (canada eh)
    loop through the forms
    for each form in forms
    form.unload
    next form

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by yoda
      how unload all forms at the same time or hide all at the same time
      Not sure whether this is what you want, but the End statement will unload all forms and end the program.

      Comment

      • sashi
        Recognized Expert Top Contributor
        • Jun 2006
        • 1749

        #4
        Hi there,

        Use the code below to unload all form except the current active form. hope it helps. Good luck & Take care.

        Code:
        'Within a form module
        
        Private Sub Form_Activate()
        
        'Form_Activate is a logical place to do this
        
        Dim oFrm As Form
        
        For Each oFrm In Forms
          if oFrm.Name <> me.Name and Not _
            (TypeOf oFrm Is MDIForm) then Unload oFrm
        Next
        
        End Sub
        
        'OR: As a function in a .Bas or .cls module
        'use the name of form you don't want unloaded as parameter
        
        Public UnloadAllExceptOne(FormToStay as String)
        
        dim oFrm as Form
        
        for each oFrm in Forms
        	if oFrm.Name <> FormToStay and Not _
                     (TypeOf oFrm Is MDIForm) then unload oFrm
        next
        
        End Sub

        Comment

        • yoda
          Contributor
          • Dec 2006
          • 291

          #5
          thanks thats all i needed guys, sorry i found it out my self last night but i will try
          your codes

          thanks alot Yoda Canada Eh

          Comment

          • Wielebny
            New Member
            • Jan 2007
            • 1

            #6
            it would be really nice if You shared with us what You found out

            Comment

            Working...