如题,分不够可以再加。

解决方案 »

  1.   

    做成控件数组,就是把所有文本框起一个名字,用Index分辨它们。这样就是同一个焦点事件了。
      

  2.   

    没有!控件数组是好办法!否则可以做一个通用的sub或者Function在焦点事件内调用
      

  3.   

    好久没有贴过代码了...贴一段,参考一下(在窗体上放几个TEXTBOX),然后,COPY下面代码即可:Option ExplicitDim WithEvents Ev_Text As VB.TextBox
    Dim WithEvents smTimer As Timer
    Dim M_NewActCon As ObjectPrivate Sub Ev_Text_KeyPress(KeyAscii As Integer)
            If KeyAscii = 13 Then
                KeyAscii = 0
                SendKeys "{TAB}"
            End If
    End SubPrivate Sub Form_Load()
        If smTimer Is Nothing Then
           Set smTimer = Me.Controls.Add("VB.Timer", "smTimer", Me)
           smTimer.Interval = 50
           smTimer.Enabled = True
        End If
    End SubPrivate Sub smTimer_Timer()
            Static NewName As String
            Static OleName As String
            
            Set M_NewActCon = Me.ActiveControl
            NewName = M_NewActCon.Name
            If NewName <> OleName Then
               If UCase$(TypeName(M_NewActCon)) = "TEXTBOX" Then
                  Set Ev_Text = M_NewActCon
               End If
            End If
    End Sub
      

  4.   

    to  MSTOP(陈建华) :键盘事件是可以,我要的是焦点事件,能否具体点
      

  5.   

    一样的,你IDE中选择相应的焦点事件就可以了..
      

  6.   

    只响应LostFocus,不响应gotFocus
      

  7.   

    //////vb6有没有重写控件类来统一一个控件的事件阿///////
    http://community.csdn.net/Expert/topic/3353/3353756.xml?temp=.6370966
      

  8.   

    可以用tag来控制啊
    或者设置同样的属性啊