如何在文本框中键入时专注于按钮

时间:2015-03-13 22:13:06

标签: c#-4.0

**如果我有一个文本框和一个按钮。如果我在文本框中输入了一个字母,那么控件必须自动对焦于按钮。所以,当我点击输入时按钮下的代码将执行**

   I tried  button1.focus();// in text box but it transfering the control to button so that I cant able to type in text box.

1 个答案:

答案 0 :(得分:0)

1.选择按钮所在的表单。 2.在“属性”窗口中,将窗体的 AcceptButton 属性设置为Button控件的名称。

相关问题