Created
July 30, 2013 14:13
-
-
Save PyramisDev/6113260 to your computer and use it in GitHub Desktop.
Let the user press Ctrl-A to select all of the text in a TextBox in VB .NET
When the TextBox's KeyPress event sees the Ctrl-A key code (1), it casts the event's sender into a TextBox and calls the TextBox's SelectAll method. The code then sets e.Handled to True to indicate that the character has been handled. This prevents the TextBox from beeping.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If e.KeyChar = Convert.ToChar(1) Then | |
DirectCast(sender, TextBox).SelectAll() | |
e.Handled = True | |
End If |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the hint. Here's the code for Vb.NET 2017+: