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. close form

close form

Scheduled Pinned Locked Moved Visual Basic
questioncsharp
7 Posts 5 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.
  • S Offline
    S Offline
    Smithers Jones
    wrote on last edited by
    #1

    vb.net: i want to set a boolean variable to false, when a certain form is closed. how can i catch this close-event?

    C M C 3 Replies Last reply
    0
    • S Smithers Jones

      vb.net: i want to set a boolean variable to false, when a certain form is closed. how can i catch this close-event?

      C Offline
      C Offline
      coolestCoder
      wrote on last edited by
      #2

      Hi,

      klappklapp wrote:

      how can i catch this close-event?

      First of all there is no close event. There is an Unload event. Also i am assuming that you want to set a boolean value to false when a form is unloaded. Then just write the code - someBoolvar = False in form_unload event. Or if you want to call some function when a form is unloaded either the same syntax can be used or you can subscribe to the unload event of that form. Just find the form object press "." and find the unload event. In this way your function will be called whenever the unload event is fired of that form. Hope i am clear. and my assumptions are rigth. Anant Y. Kulkarni

      C 1 Reply Last reply
      0
      • S Smithers Jones

        vb.net: i want to set a boolean variable to false, when a certain form is closed. how can i catch this close-event?

        M Offline
        M Offline
        Mohammed Amine
        wrote on last edited by
        #3

        hi, i'm not soo agree with the guy answered before i just tryed close event for the same target it works be sure man ;) try to be good if you can't be the best

        1 Reply Last reply
        0
        • C coolestCoder

          Hi,

          klappklapp wrote:

          how can i catch this close-event?

          First of all there is no close event. There is an Unload event. Also i am assuming that you want to set a boolean value to false when a form is unloaded. Then just write the code - someBoolvar = False in form_unload event. Or if you want to call some function when a form is unloaded either the same syntax can be used or you can subscribe to the unload event of that form. Just find the form object press "." and find the unload event. In this way your function will be called whenever the unload event is fired of that form. Hope i am clear. and my assumptions are rigth. Anant Y. Kulkarni

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          The OP didn't specify WinForms or WebForms. Your answer is WebForms specific as there is a Close event in WinForms.


          "On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871) My: Website | Blog

          1 Reply Last reply
          0
          • S Smithers Jones

            vb.net: i want to set a boolean variable to false, when a certain form is closed. how can i catch this close-event?

            C Offline
            C Offline
            Colin Angus Mackay
            wrote on last edited by
            #5

            You can add an event handlier for the closing or closed event. If you chose the closing event be aware that the form might not get closed as another event handler for the closing event will be given the opportunity to cancel the action. NOTE: This assumes you are talking about a Win Forms application.


            "On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871) My: Website | Blog

            S 1 Reply Last reply
            0
            • C Colin Angus Mackay

              You can add an event handlier for the closing or closed event. If you chose the closing event be aware that the form might not get closed as another event handler for the closing event will be given the opportunity to cancel the action. NOTE: This assumes you are talking about a Win Forms application.


              "On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871) My: Website | Blog

              S Offline
              S Offline
              Smithers Jones
              wrote on last edited by
              #6

              win form, it is. thanks.

              D 1 Reply Last reply
              0
              • S Smithers Jones

                win form, it is. thanks.

                D Offline
                D Offline
                D111
                wrote on last edited by
                #7

                Closing and Closed events only exist as Closing and Close in .NET Framework versions 1 and 1.1 . If you upgrade to version 2 (2005 edition) just be aware that the events have been renamed FormClosing and FormClosed.

                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