如何使用 Enter 调用事件处理程序? [英] How can I use Enter to call event handler?

查看:27
本文介绍了如何使用 Enter 调用事件处理程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 textBox 和搜索 button,我想问一下如何让用户可以点击 Enter 开始搜索而无需点击搜索 <代码>按钮?

I have a textBox and search button, I would ask about how can I make the user can click Enter to start searching without need to go and click the search button?

推荐答案

Form 有一个名为AcceptButton"的属性,用于标识一个应该与Enter"按键关联的按钮.它被认为是表单的默认操作".

The Form has a property called "AcceptButton" that identifies a button that should be associated to the "Enter" keypress. Its considered the "default action" for the form.

更多信息在这里:

Windows 窗体 - AcceptButton 属性

这篇关于如何使用 Enter 调用事件处理程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆