Monday, August 26, 2013

Close WinForm with Escape Key in visual basic

Close WinForm with Escape Key in visual basic

Close WinForm
How to close a Winform by pressing ESC ? Using VB is very simple. Here is the sample code:


Private Sub Form1_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp

        If e.KeyCode = Keys.Escape Then
            Me.Close()
        End If

End Sub


Visual basic is a very popular programming language and is important to use it to make nice programs. That includes for example good user interface.
Put an Escape function and a cancel function in very of your applications to enhance your work.

1 comment: