Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Event not finished - Form Closing causes nullreference exception

Event not finished - Form Closing causes nullreference exception

Scheduled Pinned Locked Moved Visual Basic
javascriptdata-structureshelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nlarson11
    wrote on last edited by
    #1

    Hello, I'm just looking for ideas/techniques to apply to form to handle logon running events and blocking the user from closing the form until those events are done. Is there some formal way to do this or is a just a matter of using boolean to indicate idle status, etc? Situation: - user clicks on button causing a transaction - while the event is processing the user clicks on the Close Button (X). - the transaction returns and starts processing. it is possible to get the close event to fire while the transaction reply is being processed. So reply is being processed, the close event starts cleaning up objects (set to nothing/dispose) and the event uses one of those objects and 'object not set'. Note: We are using bubble up error handling so the top of the stack is the button. but we are also using threadexception handling so it too would need to react accordingly. Thank you for your time... Nathan

    'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

    L 1 Reply Last reply
    0
    • N nlarson11

      Hello, I'm just looking for ideas/techniques to apply to form to handle logon running events and blocking the user from closing the form until those events are done. Is there some formal way to do this or is a just a matter of using boolean to indicate idle status, etc? Situation: - user clicks on button causing a transaction - while the event is processing the user clicks on the Close Button (X). - the transaction returns and starts processing. it is possible to get the close event to fire while the transaction reply is being processed. So reply is being processed, the close event starts cleaning up objects (set to nothing/dispose) and the event uses one of those objects and 'object not set'. Note: We are using bubble up error handling so the top of the stack is the button. but we are also using threadexception handling so it too would need to react accordingly. Thank you for your time... Nathan

      'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, the FormClosing event has a FormClosingEventArgs parameter; of interest are the CloseReason property, telling you why the form would close, and the Cancel property, which when set to true prevents the form closing. :)

      Luc Pattyn


      Local announcement (Antwerp region): Lange Wapper? Neen!


      N 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, the FormClosing event has a FormClosingEventArgs parameter; of interest are the CloseReason property, telling you why the form would close, and the Cancel property, which when set to true prevents the form closing. :)

        Luc Pattyn


        Local announcement (Antwerp region): Lange Wapper? Neen!


        N Offline
        N Offline
        nlarson11
        wrote on last edited by
        #3

        Thank you for replying Luc... So basically i would need to create a variable to indicate i'm within a click event and check that flag within the closing event and if the flag is true, then cancel the close else let it happen. i was hoping for some flag that's built into indicate if any of the form's events are "busy"... thanks again.

        'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups