Highlight text in textbox

  • Thread starter Thread starter Erwin Bormans
  • Start date Start date
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
 
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.
 
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
 
Back
Top