Stoping the close event


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Stoping the close event

  1. #1
    Join Date
    Jul 2007
    Posts
    17

    Unhappy Stoping the close event

    Hai Friends, this is me sundar. I have a doubt in vb6.In my project, When i click the close button it should show a msgbox as 'Do u want to exit'. if i click 'No' button in that msgbox, the form should not be closed. What is the coding? In which event i want to write this coding?

  2. #2
    Join Date
    Aug 2007
    Posts
    2

    Smile

    Use the Form_Unload event. Make sure to show the form once again if the user chooses 'No' on your message box.
    Pranav
    PN, India

  3. #3
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Code:
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        Dim Result As Integer
        Result = MsgBox("Do you want to exit?", vbYesNo, "Closing")
        If Result = vbNo Then
            Cancel = True
        End If
    End Sub
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. Coding for Close Form Event
    By Lithic in forum VB Classic
    Replies: 4
    Last Post: 02-28-2005, 07:03 PM
  2. How long before the next version??
    By _CAG in forum .NET
    Replies: 146
    Last Post: 08-12-2002, 11:40 PM
  3. How can I trap the close event of IE
    By Sunil Menon in forum .NET
    Replies: 0
    Last Post: 07-01-2002, 07:53 AM
  4. Re: App Object (fixes)
    By Rob Teixeira in forum .NET
    Replies: 129
    Last Post: 06-06-2002, 06:23 AM
  5. Window close button event
    By Stephen Proulx in forum VB Classic
    Replies: 2
    Last Post: 03-22-2000, 05:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center