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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i select text on tab into

Status
Not open for further replies.

tbellomo

Technical User
Jan 28, 2002
73
US
Hello all,
This has to be easier than it seems! I'm doing my 2nd VB6 application, and previously "programmed" in Access. All I want is to have the the text in a textbox selected when I tab to it. It did this automatically in Access. I know I could build a function utilizing the selstart, etc, but then I would still have to call it in every control's "GotFocus" Event. There must be an easier way! Please advise if you can.

I appreciate it,
Tim Bellomo
 
A couple options would be to use a control array when possible. This way you will only need to place code in one Got focus event.

Another option would be to create an active X text box control that will do do that when you set a property at design time. Search or other code repositories to see if someone has already created and posted such a control.


To reduce typing you could also creat a public sub that you can pass the text box control to and it will hightlight the text for you. You will still need to place code in each gotfocus event but only one line to call the procedure instead of three.


Thanks and Good Luck!

zemp
 
thanks for your post...

I don't know, it just seems like it should be easier than that!

It seems like it should just be a property setting.

Thanks again,
Tim
 
There are 2 ways of getting VB to do exactly what you want:

1. Write to Mr W Gates, Redmond (Don't hold your breath waiting!) [smile]

2. Write your own ActiveX control. It's easier than you may think, there are loads of samples around, including some good examples in VBHelp


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top