Results 1 to 16 of 16

Thread: Dispose form by Close button [Resolved]

Threaded View

  1. #1

    Thread Starter
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163

    Question Dispose form by Close button [Resolved]

    I would like to add a "confirm exit?" message box when I press the Close(X) button at the top right of my form.

    So I try to modify the following code found at the Region " Windows Form Designer generated code ":

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing)
    End Sub

    But I failed. What I one is:
    When I press the Close(X) button, the form is still open, and a message box will pop up asking whether you are sure to exit?
    If Yes, the form will be dispose.
    If No, no action is taken, and the form is still remain there.

    How can I do so?

    Please guide. Thank you.
    Last edited by albertlse; Aug 21st, 2003 at 08:33 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
  •  



Click Here to Expand Forum to Full Width