你可以把代码改为:
  在text1的keydown事件中加入:
  if keyascii=13 then 
     textbox2.setfouce
  endif    

解决方案 »

  1.   

    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
      

  2.   

    Private Sub Text1_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then SendKeys "{TAB}"
    End Sub
    win2000server 下通过!
      

  3.   

    你在text1的keypress写
       If KeyAscii = vbKeyReturn Then
          Text2.SetFocus
        End If
      

  4.   

    写的时候最好再加上keyascii=0,这样可以去掉系统讨厌"ding"的声音!
      

  5.   

    to  lincanwen(海) (
    我的代码就是这样写的,我在题目里没写清楚,出现题目里写的锁键盘的情况不知是不是代码的原因?
      

  6.   

    Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    KeyAscii = 0
    Text2.SetFocus
    End If
    End Sub
      

  7.   

    响应回车事件后textbox2.setfocus
      

  8.   

    多谢各位!!!!!TO chinareny(编程浪子) 请问是不郑州的程序高手,我好像在论坛里见过大名,
      

  9.   

    我在win2000(server版)能通过!可能是你系统或者别的原因吧!
      

  10.   

    应该都可以通过
    不过我用Text2.SetFocus
      

  11.   

    我在win2000(server版)也能通过,我想问的是:SendKeys "{TAB}"是不是
    锁键盘的原因?因为有时锁键盘!
      

  12.   

    在text1的keypress事件中加入代码:
    if keyasii=13 then
    text2.setfocus
    end if