How To Select All Text in a Field When It Gets the Focus (161240)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q161240 SUMMARY
Automatic highlighting is useful in data entry boxes where you want to give
the user the option to overwrite the existing contents quickly by pressing
any character key.
This article demonstrates how to select (highlight) all text in a text box
automatically whenever the text box gets the focus. This example also
applies to the ComboBox and Grid control and any other controls that
implement the Text, SelStart, and SelLength properties.
REFERENCES
Visual Basic On-Line Help: Text, SelLength, SelStart Properties
(c) Microsoft Corporation 1996, All Rights Reserved.
Contributions by Ted Keith, Microsoft Corporation
Modification Type: | Minor | Last Reviewed: | 7/13/2004 |
---|
Keywords: | kbhowto KB161240 |
---|
|