CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 1999
    Location
    Hyderabad, India.
    Posts
    3

    How to chatch "exit" button?

    Hi all,
    Please let me know how to catch the "exit" (x button in the top-right corner) so that I can ask whether or not user wants to quit.

    Thank you.


  2. #2

    Re: How to chatch "exit" button?

    In the form's query unload event:

    if UnloadMode <> vbFormCode the
    'Ask the user.
    'if the user responds that he doesn't want to quit:
    Cancel = true

    end if





  3. #3
    Join Date
    Oct 1999
    Location
    Pune - Maharashtra - India
    Posts
    6

    Re: How to chatch "exit" button?

    Write the folloing code on form unload event :


    private Sub Form_Unload(Cancel as Integer)
    Dim iChoice as Integer
    iChoice = MsgBox("Are you sure ? ", vbYesNo, "Exit")
    If iChoice = vbNo then
    Cancel = true
    End If
    End Sub





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured