VB中怎样设置使安回车键相当于单击按钮?

如题所述

第1个回答  2009-08-05
我明白你要的意思
这样把CommandButton的default属性设置为true即可,程序运行时直接回车!!

不会没分吧?
第2个回答  2009-08-05
最好途径:按钮的default设为真
此好的:窗体的keypreview设为真
然后:
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command1.Value = True
End Sub
第3个回答  推荐于2017-10-10
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Command1.Value = True
If KeyCode = 27 Then command2.Value = True
End Sub
Command1是“是”按钮
Command2是“否”按钮本回答被提问者采纳
第4个回答  推荐于2017-10-14
如果有一按钮事件Command1_Click
private sub text1_keypress(...)
if keyascii=13 then
Command1_click
end if
end sub
第5个回答  2009-08-05
设置该按纽的Default属性为ture