Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move Cursur to end of line 1

Status
Not open for further replies.

Andrexxx

IS-IT--Management
Joined
May 3, 2005
Messages
18
Location
US
Hello,

I saw a thread in here that I can't seem to find anymore (I was sure I bookmarked it ...) that described how to move the cursur to the end of the line of a textbox when it the textbox is selected programatically (Vs. highlighting all the text).

I tried to use VbKeyEnd, but that took me to the end of the form.

Any help?
 
Take a look at the SelLength and SelStart properties.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV,

Thanks again ...
 
After setting the focus to the text box you could use:

SendKeys "{F2}"

which is equivalent to pressing F2, which moves the cursor to the end of the text and removes the highlighting.

Hope this helps.
 
Sendkeys - hmmm - you'll find that lot of members here discourages usage of Sendkeys, for several reasons. Some pretty smart Access Developers have also included a reference to them in The Ten Commandments of Access #9.

I'll prefer PHV's suggestion.

Roy-Vidar
 
Roy, I don't disagree with you. I don't use Sendkeys very often, but sometimes it is very convenient as I have explained in thread702-1056465.

I was just offering it as an alternative here.

Whilst the "10 Commandments" are great in theory (and in the vast majority of occasions should be adhered to), I have found that there are times when "other" solutions are better for the job in hand. Additionally, I think that a developer should be able to decide for him/herself which solution to use from those that are available. This is one of the reasons why I think TT is so good. In many cases a selection of alternatives are presented to the Original Poster.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top