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. How can I change the behavior of the "Close" button in a form?

How can I change the behavior of the "Close" button in a form?

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
4 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.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    How to implement the following function: If click the close button of a window, there will be a messagebox with two selections "YES" and "NO". If "YES" is selected, the window is closed as usual. If "NO" is selected, the application will return to the preivous window. Thanks.

    A 1 Reply Last reply
    0
    • A Anonymous

      How to implement the following function: If click the close button of a window, there will be a messagebox with two selections "YES" and "NO". If "YES" is selected, the window is closed as usual. If "NO" is selected, the application will return to the preivous window. Thanks.

      A Offline
      A Offline
      Andy Davies
      wrote on last edited by
      #2

      find the forms OnClosing event, and show a message box from there, if they press yes, just continue and if they press No, you can set e.cancel = True which will stop the form closing. hope this helps - Andy http://www.guardian.co.nr

      A 1 Reply Last reply
      0
      • A Andy Davies

        find the forms OnClosing event, and show a message box from there, if they press yes, just continue and if they press No, you can set e.cancel = True which will stop the form closing. hope this helps - Andy http://www.guardian.co.nr

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Andy, I got it. Thank you so much!

        A 1 Reply Last reply
        0
        • A Anonymous

          Andy, I got it. Thank you so much!

          A Offline
          A Offline
          Andy Davies
          wrote on last edited by
          #4

          Glad to be of help :) http://www.guardian.co.nr

          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