|
-
May 18th, 2000, 10:28 PM
#1
Thread Starter
New Member
What is the best way to select all the text and highlight it in a text box, when i give it focus? Any help would be great
[Edited by dionj on 05-19-2000 at 11:29 AM]
-
May 18th, 2000, 10:39 PM
#2
Member
Check it out
Code:
Private Sub Text1_GotFocus()
Text1.SelLength = Len(Text1.Text)
End Sub
ALL THE BEST
-
May 18th, 2000, 10:41 PM
#3
Hyperactive Member
I suggest that you use a richtextbox control, in order for you to use it though you must go to projects --> components, then click Microsoft Rich Text Box control.
Then you can add it to the form just like a text box. But it gives you some nice methods to use, Ill let you look them up of course though. If you still need help after this, email me or repost.
Cheers
Bill Rogers
-
May 18th, 2000, 10:53 PM
#4
Fanatic Member
Actually i think you will find that you need to specify where to start the selection at. Otherwise you might get half of the text selected or none if the cursor is at the end of the box.
Code:
Private Sub txtName_GotFocus()
txtName.SelStart = 0
txtName.SelLength = Len(txtName.Text)
End Sub
Iain, thats with an i by the way!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|