你建立个控件数组,然后
txtMyText(i).SetFocus就简单了

解决方案 »

  1.   

    1.可以用控件数组2.可以把窗体的KeyPreview设为True,用窗体的KeyPress事件来处理
      

  2.   

    me.KeyPreview=True
    Private Sub Form_KeyPress(KeyAscii As Integer)
    if keyascii=13 then  sendkeys "{TAB}"
    End Sub
      

  3.   

    '看一下这段代码吧,放在公共模块中,ok
    Public Sub Fn(ByRef f As Form, ByRef KeyAscii As Integer) 'Enter键转换Tab键过程,用在表单编辑时
        On Error Resume Next
        If KeyAscii = 13 Then
            If Not (TypeOf f.ActiveControl Is CommandButton) Then
                If TypeOf f.ActiveControl Is TextBox Then
                    If Not f.ActiveControl.MultiLine Then
                        KeyAscii = 0
                        SendKeys "{tab}"
                    End If
                Else
                        KeyAscii = 0
                        SendKeys "{tab}"
                End If
            End If
        End If
    End Sub