vb中怎么编ctrl+a选择所有文本??

来源:百度知道 编辑:UC知道 时间:2024/06/16 00:04:07
好一个text1,只有输入字母和返回键时有效,输入其它字符不显示在文本框里,按ctrl+a可全选text1.text,请问应该怎么做?、、

Private Sub Text1_KeyPress(KeyAscii As Integer)

If (KeyAscii >= Asc("a") And KeyAscii <= Asc("z")) Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("Z")) = False Then KeyAscii = 0

End Sub

Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
If Shift = 2 And (KeyCode = Asc("A") Or KeyCode = Asc("a")) Then
    With Text1
    .SelStart = 0
    .SelLength = Len(Text1.Text)
    End With
End If
End Sub

加点分呗

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = 2 An