closing form / X Button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    closing form / X Button

    hi, is it possible to run a code when the form is closed.

    What i mean is... when the user clicks the x on the top right to close the form, can i run code before the form closes?

    i have done something simular before... when the user clicks the x button a dialog box appears says "are you sure"... "yes" or "No"

    But i forgot how i did it.

    please help

    Thanks James
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    The details will vary a bit between versions of VB, but you probably want to place your code in the Unload or QueryUnload event procedures. One important difference is that in the QueryUnload, you can refuse to let the form be unloaded, by setting the Cancel parameter to True.

    Comment

    Working...