Possible Duplicate:
C# How do I click a button by hitting Enter whilst textbox has focus?
I want when I press enter it will resemble clicking but开发者_如何学Cton. I have a textbox used a search box when the button is Levahtim search begins. I want that clicking the enter do the same thing.
Handle the TextBox.KeyDown
event adding the following:
if (args.KeyCode == Keys.Return)
{
button.PerformClick();
}
Refer to:
Control.KeyDown Event
Button.PerformClick Method
@sharon: I believe that you can find the answer here:
C# How do I click a button by hitting Enter whilst textbox has focus?
精彩评论