在VB中怎样用键盘控制command1键和command2键
PrivateSubCommand1_Click()Ifnum=1Ornum=3Ornum=5Thenct=ct+1EndIfCommand1.Enabled=False...
Private Sub Command1_Click()
If num = 1 Or num = 3 Or num = 5 Then
ct = ct + 1
End If
Command1.Enabled = False
Command2.Enabled = False
End Sub
Private Sub Command2_Click()
If num = 2 Or num = 4 Or num = 6 Then
ct = ct + 1
End If
Command1.Enabled = False
Command2.Enabled = False
End Sub
上面的程序要怎么改,急急急啊T.T
用键盘上的A键和B键控制。 展开
If num = 1 Or num = 3 Or num = 5 Then
ct = ct + 1
End If
Command1.Enabled = False
Command2.Enabled = False
End Sub
Private Sub Command2_Click()
If num = 2 Or num = 4 Or num = 6 Then
ct = ct + 1
End If
Command1.Enabled = False
Command2.Enabled = False
End Sub
上面的程序要怎么改,急急急啊T.T
用键盘上的A键和B键控制。 展开
1个回答
展开全部
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 65 Then '按下键盘A键
If num = 1 Or num = 3 Or num = 5 Then
ct = ct + 1
End If
Command1.Enabled = False
Command2.Enabled = False
End If
If KeyCode = 66 Then '按下键盘B键
If num = 2 Or num = 4 Or num = 6 Then
ct = ct + 1
End If
Command1.Enabled = False
Command2.Enabled = False
End If
End Sub
If KeyCode = 65 Then '按下键盘A键
If num = 1 Or num = 3 Or num = 5 Then
ct = ct + 1
End If
Command1.Enabled = False
Command2.Enabled = False
End If
If KeyCode = 66 Then '按下键盘B键
If num = 2 Or num = 4 Or num = 6 Then
ct = ct + 1
End If
Command1.Enabled = False
Command2.Enabled = False
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询