Results 1 to 7 of 7

Thread: Should be an easy one!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    3
    I just finished writing my first program... After compiling it I ran it, then I used the X on the border to close it. At first, everything seemed normal but I checked my task manager and my program was still running!!!!
    Is there something I need to set in order to make it functional?

    Thanx

  2. #2
    Guest
    Code:
    Private Sub Form_Unload()
    
        Dim F As Form
        
        For Each F In Forms
            Unload F
        Next F
    
    End Sub

  3. #3
    Guest
    You should set each form to nothing so it doesn't still use any resources after it has been unloaded.

    Code:
    Public Sub UnloadAllForms()
    Dim OfTheseForms As Form
    For Each OfTheseForms In Forms
    Unload OfTheseForms
    Set OfTheseForms = Nothing
    Next OfTheseForms
    End Sub

  4. #4
    Guest
    Or use the End command.

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    3

    In reply to Denniswrenn's reply

    I don't know if I'm just stupid but when compiling it doesn't seem to like the "Private sub Form_Unload" what should I modify to adapt it to my program?

    Thanx

  6. #6
    Guest
    Hehe, don't copy that Private Sub Form_Unload event. The code Dennis gave is suppose to go in that event. But his code only unloads them, doesn't set them so they don't use any resources. You should use UnloadAllForms(). And even, as Megatron suggested, put an end after it all.

    Code:
    Public Sub UnloadAllForms()
    Dim OfTheseForms As Form
    For Each OfTheseForms In Forms
    Unload OfTheseForms
    Set OfTheseForms = Nothing
    Next OfTheseForms
    End
    End Sub

  7. #7

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    3

    Wink Thanx

    Thank you!

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