开发者

That enter will replace button_click [duplicate]

This question already has answers here: Closed 11 years ago.

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜