Results 1 to 3 of 3

Thread: Controlling the X in the upper right-hand corner.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    30

    Question Controlling the X in the upper right-hand corner.

    How would one go about controlling this form element? I would like to prompt the user before closing the application. Also, what about capturing ALT-F4?

    Thanks,

    Chris
    Chris Lynch

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Override the onclosing method and handle the closing event
    VB Code:
    1. Protected Overrides Sub OnClosing(ByVal e As System.ComponentModel.CancelEventArgs)
    2.         Dim closing As DialogResult = MessageBox.Show("Are you sure you want exit?", "Exit", MessageBoxButtons.YesNo)
    3.         If (closing = DialogResult.Yes) Then
    4.             e.Cancel = False
    5.         Else
    6.             e.Cancel = True
    7.         End If
    8. End Sub

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    30
    Thanks. That worked.
    Chris Lynch

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