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

2024-05-05 12:17:53
推荐回答(5个)
回答1:

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

不会没分吧?

回答2:

最好途径:按钮的default设为真
此好的:窗体的keypreview设为真
然后:
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command1.Value = True
End Sub

回答3:

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:

如果有一按钮事件Command1_Click
private sub text1_keypress(...)
if keyascii=13 then
Command1_click
end if
end sub

回答5:

设置该按纽的Default属性为ture