Solved

sleecting text on text box

Posted on 2002-04-18
2
145 Views
Last Modified: 2010-05-02
Ho do I select text on a text box in code.
If the user enters incorrect data I have setfocus to the text box but how do I highlight the text

Merlin007
0
Comment
Question by:merlin007
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 6950159
Use this:

With Text1
  .SelStart = 0
  .SelLength = Len(.Text)
End With


In the Text1_GotFocus event.
0
 

Author Comment

by:merlin007
ID: 6950175
Thanks Tim

Excellent help as usual

merlin007
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now