Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleLet the user select all text with Ctrl-A
Keywordstextbox, ctrl-a, control-a, select all
CategoriesControls
 
In the TextBox's KeyPress event handler, check for the Ctrl-A key combination. If the user presses Ctrl-A, use the TextBox's SelStart and SelLength properties to select all of the control's text.
 
Private Sub Text1_KeyPress(KeyAscii As Integer)
Const ASC_CTRL_A As Integer = 1

    If KeyAscii = ASC_CTRL_A Then
        Text1.SelStart = 0
        Text1.SelLength = Len(Text1.Text)
    End If
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated