Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
    If KeyAscii = 13 Then
        If Index <> 63 Then
            SendKeys vbTab
        Else
            Text1.Item(2).SetFocus
        End If
    End If
    
    KeyAscii = 0
End Sub

解决方案 »

  1.   

    在Text2_keypress(index as integer,keycode as integer)事件里if keycode=vbkeyenter then
        text2(i+1).setfocus
    end if
      

  2.   

    if keyascii =13 then
        text2(index+1).setfocus
    end if
      

  3.   

    设置好控件的tabindex的顺序.
    然后在text1的keydown时间中
    if keycode=13 or keycode=40 then
      if index<63 then sendkeys "{Tab}"
    elseif keycode=38 then
      if index>0 then sendkeys "+{Tab}"
    end if
    13是回车,40是向下箭头,38是向上箭头.
    即使不是属于一个数组的,方法稍作改进同样适用.
      

  4.   

    设置好控件的tabindex的顺序.
    然后在text1的keydown时间中
    if keycode=13 or keycode=40 then
      if index<63 then sendkeys "{Tab}"
    elseif keycode=38 then
      if index>0 then sendkeys "+{Tab}"
    end if
    13是回车,40是向下箭头,38是向上箭头.
    即使不是属于一个数组的,方法稍作改进同样适用.
      

  5.   

    在Text2_keypress(index as integer,keycode as integer)事件里if keycode=13 then
        if index<>63 then
            text2(index+1).setfocus
        else
            text2(0).setfocus
        end if
    end if
      

  6.   

    排好TABINDEX
        If KeyAscii = 13 Then
            SendKeys "{Tab}"
        End If
      

  7.   

    楼上的这个方法简单,你在控制一下i得值,比如i>63,then i=0,否则会报错
      

  8.   

    同意watt(瓦特),但是需要事先排好tab顺序