Highlight text in textbox

E

Erwin Bormans

Hi all

I want to highlight all the text in a textbox when I click on it so the user
can start typing a new value straight away.

I tried playing with selstart and sellength but it doesn't work.

Anybody an idea.

Kind Regards
Erwin
 
D

Daniel Pineault

Try something similar to the following in your click or doubel click event

Me.Text1.SetFocus
Me.Text1.SelStart = 0
Me.Text1.SelLength = Len(Me.Text6.Value)

where Text1 is the name of your textbox.
 
D

Daniel Pineault

Sorry, I made a small typo. Here it is corrected.

Me.Text1.SetFocus
Me.Text1.SelStart = 0
Me.Text1.SelLength = Len(Me.Text1.Value)
--
Hope this helps,

Daniel Pineault
 

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