You must Sign In to post a response.
  • Category: .NET

    form close

    if user presses Esc key means my form should close
  • #350806
    private void Form1_KeyPress(object sender, KeyPressEventArgs e)
    {
    if ((e.KeyChar == (System.Char)Keys.Escape))
    {

    this.Close();
    }

    }

    try this code.


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.