Results 1 to 4 of 4

Thread: end, finalize, app.exit

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Location
    Rhode Island, USA
    Posts
    29

    end, finalize, app.exit

    could someone please list for me the order of operations a form takes when it is exited? which should you use to exit a form and kill all memory allocated to it?

    thanks!

    btw y can't you call me.finalize()?

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    hmm I dont think you should call me.finalize, dunno that much about that...
    you shouldnt use the END command at all, it's EVIL!!!

    use form.close or application.exit.... form.close wouldnt necessarly end the whole application
    sorry I dont know the order of events that are fired when it's exiting.. (hmm maybe form.closing, then form.closed? I think you usually don't wanna put code in the finalize event because the form and everything is already destroyed when it's fired)
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Location
    Rhode Island, USA
    Posts
    29

    found order of events

    Opening and closing a form
    When you open a form, the following sequence of events occurs for the form:

    Open Load Resize Activate Current

    If there are no active controls on the form, the GotFocus event also occurs for the form after the Activate event but before the Current event.

    When you close a form, the following sequence of events occurs for the form:

    Unload Deactivate Close

    If there are no active controls on the form, the LostFocus event also occurs for the form after the Unload event but before the Deactivate event.

    Moving between forms
    When you switch between two open forms, the Deactivate event occurs for the first form, and the Activate event occurs for the second form:

    Deactivate (form1) Activate (form2)

    The Deactivate event for a form also occurs when you switch from the form to another window in Microsoft Access. However, the Deactivate event doesn't occur when you switch to a dialog box, to a form whose PopUp property is set to Yes, or to a window in another application.

    Note An Open event doesn't occur if you move to a form that is already open, even if you've moved to the form by carrying out an OpenForm action.

    Working with data on a form
    Form and control events occur as you move between records in the form and change data. For example, when you first open a form, the following sequence of events occurs:

    Open (form) Load (form) Resize (form) Activate (form) Current (form) Enter (control) GotFocus (control)

    Similarly, when you close a form, the following sequence of events occurs:

    Exit (control) LostFocus (control) Unload (form) Deactivate (form) Close (form)

    If you've changed data in a control, the BeforeUpdate and AfterUpdate events for both the control and the form occur before the Exit event for the control. For more information on the order of events for controls on forms, click .

    Working with subforms
    When you open a form containing a subform, the subform and its records are loaded before the main form. Thus, the events for the subform and its controls (such as Open, Current, Enter, and GotFocus) occur before the events for the form. The Activate event doesn't occur for subforms, however, so opening a main form triggers an Activate event only for the main form.

    Similarly, when you close a form containing a subform, the subform and its records are unloaded after the form. The Deactivate event doesn't occur for subforms, so closing a main form triggers a Deactivate event only for the main form. The events for the controls, form, and subform occur in the following order:

    Events for the subform's controls (such as Exit and LostFocus)


    Events for the form's controls (including the subform control)


    Events for the form (such as Deactivate and Close)


    Events for the subform

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Safest way is to put your unwanted resources in the Main Protected sub of the form Dispose() . Then use

    VB Code:
    1. Me.Dispose(true)
    2. Application.Exit()

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