新建From1(窗体),新建Text1(TextBox),Command1(按钮CommandButton),代码:
Private Declare Function GetKeyState% Lib "User32" (ByVal nVirtKey%)
Const VK_TAB = 9
Private Sub Text1_GotFocus()
    If GetKeyState(VK_TAB) < 0 Then
        Text1.SelStart = 0
        Text1.SelLength = Len(Text1.Text)
        '使用了 TAB 键
        MsgBox "Tab"
    Else
        Text1.SelLength = 0
        '使用了 MOUSE
        MsgBox "MOUSE"
    End If
End Sub鼠标点击Text1或通过Tab键到Text1,可以显示不同的“来路”。
