Do you want it so that if you press enter in your textbox it will click a button for you?

If so you can use the following:

private void txtBox_keyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 13) //13 = enter
            {
                button1.PerformClick();
            }
        }

If this is not what you want you should clarify your question.

Alternativley, set the forms AcceptButton property to the button you want to execute on Enter.
Setting the forms CancelButton property will do the same thing for Escape.
And setting the forms HelpButton captures the F1 key.

Comments
i used this. thanks

Your can use this code:

  private void TextBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            String key = Convert.ToString(e.KeyChar);
            if (key == "r")//    r notifies return key
            {
                btnSearch_Click(null, null);
            }
        }

Edited 3 Years Ago by Nick Evan: Fixed formatting

This question has already been answered. Start a new discussion instead.