Select text in field

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
 
W

Wayne Morgan

In the control's OnClick event

Me.ActiveControl.SelStart = 0
Me.ActiveControl.SelLength = Len(Me.ActiveControl.Text)
 
L

Lou Civitella

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)
 
Top