VB热键问题

来源:百度知道 编辑:UC知道 时间:2024/06/07 13:06:32
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 37 Then Command1_Click
If KeyCode = 39 Then Command2_Click

我要用左右控制Label中的显示内容,但是按左右键时,是在其他按键上移动,最后到了label栏时才能左右变化内容

还有我设置按数字键1控制command1_click
if command1.caption="" then timer1.enable=false
command1.caption已经为空了但,按下1,软件居然会计时,按道理是不会有反应的
怎么解决这两个热键问题啊?
请看清楚题目
KeyPreview 属性已经设置True

把 Form 的 KeyPreview 属性设置为 True 就可以了
再把 Command1 和 Command2 的TabStop设置为 False

不好意思啊。
Private Sub Form_KeyDown()
KeyCode As Integer, Shift As Integer
If KeyCode = 37 Then Command1_Click
If KeyCode = 39 Then Command2_Click
Then...
end if
end sub