or error resume next if keyascii=13 then dim i as long dim c i=me.activecontrol.tabindex for each c in me.controls if c.tabindex=i+1 and typename(c)="TextBox"then c.setfocus end if next end if
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End Sub win2000server 下通过!
你在text1的keypress写 If KeyAscii = vbKeyReturn Then Text2.SetFocus End If
写的时候最好再加上keyascii=0,这样可以去掉系统讨厌"ding"的声音!
to lincanwen(海) ( 我的代码就是这样写的,我在题目里没写清楚,出现题目里写的锁键盘的情况不知是不是代码的原因?
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then KeyAscii = 0 Text2.SetFocus End If End Sub
if keyascii=13 then
dim i as long
dim c
i=me.activecontrol.tabindex
for each c in me.controls
if c.tabindex=i+1 and typename(c)="TextBox"then
c.setfocus
end if
next
end if
If KeyAscii = 13 Then SendKeys "{TAB}"
End Sub
win2000server 下通过!
If KeyAscii = vbKeyReturn Then
Text2.SetFocus
End If
我的代码就是这样写的,我在题目里没写清楚,出现题目里写的锁键盘的情况不知是不是代码的原因?
If KeyAscii = 13 Then
KeyAscii = 0
Text2.SetFocus
End If
End Sub
不过我用Text2.SetFocus
锁键盘的原因?因为有时锁键盘!
if keyasii=13 then
text2.setfocus
end if