I have a form with nearly 20 Textbox and 5 Combobox and one control in dependent on the other,
Now I want to write the code for the form in such a way that, Pressing Enter Key and Tab Key should have the same functionality.
Like on pressing Tab Key the focus moves to next control should also be performed when I press the Enter Key.
Similarly when I press the Enter Key, there is some process code written in key press event but this should also be performed when I press the Tab Key.
首先使您的表单的 Keypreview 属性= True
然后将下面的代码粘贴到 Form 的 Keydown 事件中
If e.KeyCode = Keys.Enter Then
Me.SelectNextControl(Me.ActiveControl, True, True, True, False) 'for Select Next Control
End If
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)