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)
 

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