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. form_unload command to remain the form.??

form_unload command to remain the form.??

Scheduled Pinned Locked Moved Visual Basic
question
8 Posts 3 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.
  • C Offline
    C Offline
    campbells
    wrote on last edited by
    #1

    i want to cancel the function to unload or exit the form when user click on the X button at the form. how can i did that? I have set the msgbox to prompt user but wat ever anwser i give the form will just close down... y?? ****here is the code: Private Sub Form_Unload(Cancel As Integer) Dim message, dialog, title, answer message = "Do you want to Exit?" dialogtype = vbYesNo + vbQuestion title = "DELIVERY ORDER" answer = MsgBox(message, dialogtype, title) If answer = vbYes Then savedo else: exit sub End If End Sub

    C 1 Reply Last reply
    0
    • C campbells

      i want to cancel the function to unload or exit the form when user click on the X button at the form. how can i did that? I have set the msgbox to prompt user but wat ever anwser i give the form will just close down... y?? ****here is the code: Private Sub Form_Unload(Cancel As Integer) Dim message, dialog, title, answer message = "Do you want to Exit?" dialogtype = vbYesNo + vbQuestion title = "DELIVERY ORDER" answer = MsgBox(message, dialogtype, title) If answer = vbYes Then savedo else: exit sub End If End Sub

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Is this VB.NET ? I don't think so, but if it is, the closing event gets passed a Handled property in the event arg, you can set that to true to stop closing.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      C 1 Reply Last reply
      0
      • C Christian Graus

        Is this VB.NET ? I don't think so, but if it is, the closing event gets passed a Handled property in the event arg, you can set that to true to stop closing.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        C Offline
        C Offline
        campbells
        wrote on last edited by
        #3

        i using vb6. where to set =true?? form_unload=true???

        C 1 Reply Last reply
        0
        • C campbells

          i using vb6. where to set =true?? form_unload=true???

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          I thought it may be VB6. None of my advice applies, and I've never used VB6. As VB6 is officially obsolete, you should specify that's what you're using, people are bound to assume .NET otherwise.

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

          C 1 Reply Last reply
          0
          • C Christian Graus

            I thought it may be VB6. None of my advice applies, and I've never used VB6. As VB6 is officially obsolete, you should specify that's what you're using, people are bound to assume .NET otherwise.

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

            C Offline
            C Offline
            campbells
            wrote on last edited by
            #5

            so do u know how to set the value in vb.net? wat command to use to cancel the closing of the form?

            C D 2 Replies Last reply
            0
            • C campbells

              so do u know how to set the value in vb.net? wat command to use to cancel the closing of the form?

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Yes, you do what I said. But, that is irrelevant, it's not going to help you in VB6, obviously.

              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

              1 Reply Last reply
              0
              • C campbells

                so do u know how to set the value in vb.net? wat command to use to cancel the closing of the form?

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                You might want to read the documentation on the Form's Unload[^] event.

                Dave Kreskowiak Microsoft MVP - Visual Basic

                C 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  You might want to read the documentation on the Form's Unload[^] event.

                  Dave Kreskowiak Microsoft MVP - Visual Basic

                  C Offline
                  C Offline
                  campbells
                  wrote on last edited by
                  #8

                  thanks found my anwser

                  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