M
Mad Scientist Jr
how do you select all text in a textbox or rich text box when the user
presses CTRL-A ?
i am looking to recreate the vb 6 code below for vb.net
thanks.
Private Sub MyTextbox_KeyDown(KeyCode As Integer, Shift As Integer)
Dim bShiftDown As Boolean
Dim bCtrlDown As Boolean
Dim bAltDown As Boolean
bShiftDown = (Shift And vbShiftMask) > 0
bCtrlDown = (Shift And vbCtrlMask) > 0
bAltDown = (Shift And vbAltMask) > 0
If (KeyCode = Asc("a") Or KeyCode = Asc("A")) _
And _
(bCtrlDown And (Not (bShiftDown Or bAltDown))) _
Then
MyTextbox.SelStart = 0
MyTextbox.SelLength = Len(MyTextbox.Text)
End If
End Sub
presses CTRL-A ?
i am looking to recreate the vb 6 code below for vb.net
thanks.
Private Sub MyTextbox_KeyDown(KeyCode As Integer, Shift As Integer)
Dim bShiftDown As Boolean
Dim bCtrlDown As Boolean
Dim bAltDown As Boolean
bShiftDown = (Shift And vbShiftMask) > 0
bCtrlDown = (Shift And vbCtrlMask) > 0
bAltDown = (Shift And vbAltMask) > 0
If (KeyCode = Asc("a") Or KeyCode = Asc("A")) _
And _
(bCtrlDown And (Not (bShiftDown Or bAltDown))) _
Then
MyTextbox.SelStart = 0
MyTextbox.SelLength = Len(MyTextbox.Text)
End If
End Sub