Results 1 to 5 of 5

Thread: ESC key?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Location
    Utah, USA
    Posts
    353

    ESC key?

    Does anyone know what setting you change to be able to push the ESC key and the window will close? Thanks!

    Brenda

  2. #2
    Member
    Join Date
    Feb 2004
    Location
    LA
    Posts
    57
    Well if you have close (or cancel) button on the form then all you have to do is go to your Form property and set CancelButton option to your Close button.


  3. #3
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    this mate?
    VB Code:
    1. Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
    2.       If e.KeyCode = Keys.Escape Then
    3.          Close()
    4.       End If
    5.    End Sub
    first set the form.keypreview property to true. if this doesn't help, i'm sorry.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Location
    Utah, USA
    Posts
    353
    Niether of those work. Or maybe I am just doing it wrong. Any other suggestions?

  5. #5
    Member
    Join Date
    Feb 2004
    Location
    LA
    Posts
    57
    It work’s on my system. I attached example file.

    Attached Files Attached Files

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