Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = 2 And KeyCode = 65 Then
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End If
End Sub
'2.
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
'Text1.SetFocus
'3.
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
Command1.Value = True '相当于用鼠标点击
End If
End Sub
Private Sub Command1_Click() '实现全选
Dim s As String
s = "123456789abcdefg"
Text1.Text = s
Dim i As Long
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub Command2_Click()
MsgBox "ok"
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then '如果输入回车键
Command2_Click
End If
End Sub