Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Application Runs On (VB6)

    Do I need to use any unload or closing statements with forms in my application.
    With one particular form ("Archive"), when closing the form and exiting the application, my project seems to run on.
    Nothing is visible on screen but checking Task manager, the application is still running.

    With my Sub Main, I am checking if the application is running and loading the previous app if it is.
    But the program won't load the prev app because it's not in the task bar ?

    I have been using FileSystemObject (fso) and have set fso to nothing after each session.

    Dim fso As New FileSystemObject
    .........................
    Set fso = Nothing.

    Have I missed something.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Application Runs On (VB6)

    Dave,

    Do you have forms that you only hide (by applying the Hide method or by setting the Visible property to False), but never unload?

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Application Runs On (VB6)

    Hans

    Yes, I use .Hide quite frequently.
    Is there some kind of class module to unload forms or memory on exiting the application ?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Application Runs On (VB6)

    I don't know of a class module, but you might try this code in the QueryUnload event of the main form of your application:

    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Dim frm As Form
    For Each frm In Forms
    If Not (frm Is Me) Then
    Unload frm
    End If
    Next frm
    Set frm = Nothing
    End Sub

    It unloads all open (visible or not) other forms when the main form is unloaded.

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Application Runs On (VB6)

    Hans
    This seems to have worked.
    I had one glitch, which I think i have solved.
    One of the forms had the main form unloding instead of hiding, which caused the program to crash ?
    Changing the statement to hide seemed to have sorted it.

    Thanks again.

Posting Permissions

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