Select text in field

  • Thread starter Thread starter Lou Civitella
  • Start date Start date
L

Lou Civitella

How can I have the user click on a text box and have all the text in the
field highlighted?
Preferrably on the On Click event of the field.

I want to simulate using the SendKeys "{F2}" but without using the SendKeys
function.

Thanks,
Lou
 
In the control's OnClick event

Me.ActiveControl.SelStart = 0
Me.ActiveControl.SelLength = Len(Me.ActiveControl.Text)
 
Thanks Wayne this works great.

Wayne Morgan said:
In the control's OnClick event

Me.ActiveControl.SelStart = 0
Me.ActiveControl.SelLength = Len(Me.ActiveControl.Text)
 
Back
Top