Form_Unload event not firing when the 'x' button is clicked


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Form_Unload event not firing when the 'x' button is clicked

  1. #1
    Rob Edwards Guest

    Form_Unload event not firing when the 'x' button is clicked

    For some reason the Form_Unload event is not firing when i click the x
    button on my app. It does minimize and maximize when the appropriate
    buttons are clicked, but not the X. Any ideas what is causing this?





  2. #2
    Arthur Wood Guest

    Re: Form_Unload event not firing when the 'x' button is clicked


    Rob,
    Have you actually set a breakpoint in the Form_Unload event Handler? That
    is the only way to prove that it is not being executed (and I will almost
    guarantee that it is in fact being executed). What you may be finding is
    the the Form does not actually unload, usually because something on the form
    is holding an active reference, or something else is holding a active reference
    to the form you are attempting to unload.

    Arthur Wood

    "Rob Edwards" <REdwards@aclt.net> wrote:
    >For some reason the Form_Unload event is not firing when i click the x
    >button on my app. It does minimize and maximize when the appropriate
    >buttons are clicked, but not the X. Any ideas what is causing this?
    >
    >
    >
    >




  3. #3
    Bob Butler Guest

    Re: Form_Unload event not firing when the 'x' button is clicked


    "Rob Edwards" <REdwards@aclt.net> wrote in message
    news:3ac35a8d@news.devx.com...
    > For some reason the Form_Unload event is not firing when i click the x
    > button on my app. It does minimize and maximize when the appropriate
    > buttons are clicked, but not the X. Any ideas what is causing this?
    >


    When you click the X the Form_QueryUnload will fire first -- do you have
    code there that cancels the unload?




  4. #4
    Micah Nasarow Guest

    Re: Form_Unload event not firing when the 'x' button is clicked

    Rob,

    This has happened to me once.

    I had created my Form object in a Module like...
    Public g_objStartUp As New frmMain

    Sub Main()
    g_objStartUp.Show
    End Sub

    And if I referenced the form object somewhere in the code as frmMain instead
    of g_objStartUp, when the program is closed the frmMain would stay loaded.

    Just another tip/ bug to look for in your code.

    Micah


    "Rob Edwards" <REdwards@aclt.net> wrote in message
    news:3ac35a8d@news.devx.com...
    > For some reason the Form_Unload event is not firing when i click the x
    > button on my app. It does minimize and maximize when the appropriate
    > buttons are clicked, but not the X. Any ideas what is causing this?
    >
    >
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center