Selected Text in text box

P

Peter Cole

If i Tab from one text box I have the options set so that
the contents are selected. any sugestions how I can make
it so that if i use the mouse the text is selected.

Thanks
Peter Cole
 
W

Wayne Morgan

Using the Mouse Up or Click event of the control try something like

Me.txtNameOfTextbox.SelStart = 0
Me.txtNameOfTextbox.SelLength = Len(Me.txtNameOfTextbox.Text)

I tried the Enter and Got Focus events, but apparently they fired before the
mouse click was done and so the highlight got erased. The Mouse Up event is
late enough to avoid this problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top