Highlight all Text in a Textbox when the textbox is selected

Highlight all Text in a Textbox when the textbox is selected

Post by RPIJ » Sun, 30 Oct 2005 02:48:08



I must be missing something, but when I select the text box I want al
of the information in the text box selected automatically so that I ca
just start entering information and the original text is deleted.
Please help
 
 
 

Highlight all Text in a Textbox when the textbox is selected

Post by Tom Ogilv » Sun, 30 Oct 2005 03:31:42

What kind of text box. Where is it located? Are you asking how to program
something or just wishing?

--
Regards,
Tom Ogilvy



"RPIJG" < XXXX@XXXXX.COM > wrote in

http://www.yqcomputer.com/

 
 
 

Highlight all Text in a Textbox when the textbox is selected

Post by Leith Ros » Sun, 30 Oct 2005 04:15:14


Hello RPIJG,

If you want to highlight the text inside a TextBox on a user form whe
the user clicks the TextBox, this code will do that.

Inset this code into the Mouse_Up Event for the TextBox. Chang
TextBox1 in the Example to match the name of your TextBox.


Code
-------------------
Private Sub TextBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

With TextBox1
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With

End Sub

-------------------


Sincerely,
Leith Ros
 
 
 

Highlight all Text in a Textbox when the textbox is selected

Post by RPIJ » Sun, 30 Oct 2005 04:28:52


Sorry Tom I guess it was a bit of both, a wish and a need to program
Leith that works great thanks