谢谢哥们,刚才写了如下程序,好了
不过每个文本框都要一个sub不好看呀,我的界面至少10个框,能不能用一个sub把他们都写进去呢?
Private Sub Txtxs_GotFocus()
        Dim bIsErr As Boolean
        
        bIsErr = TxtXS
        If bIsErr = True Then
        
        TxtXS.SelStart = 0
        TxtXS.SelLength = Len(TxtXS.Text)
        End If
End Sub
Private Sub Txtfen_GotFocus()
        Dim bIsErr As Boolean
        
        bIsErr = TxtFen
        If bIsErr = True Then
        
        TxtFen.SelStart = 0
        TxtFen.SelLength = Len(TxtFen.Text)
        End If
End Sub
Private Sub TxtNian_GotFocus()
        Dim bIsErr As Boolean
        
        bIsErr = TxtNian
        If bIsErr = True Then
        
        TxtNian.SelStart = 0
        TxtNian.SelLength = Len(TxtNian.Text)
        End If
End Sub