Highlight Dropdown Box On Click

  • Thread starter Thread starter Alan Z. Scharf
  • Start date Start date
A

Alan Z. Scharf

I would like to have text of dropdown box highlighted when user clicks
anywhere in dropdown box, so user doesn't have to highlight text before
typing over.

How can I do this?

Thanks.

Alan
 
Alan said:
I would like to have text of dropdown box highlighted when user clicks
anywhere in dropdown box, so user doesn't have to highlight text before
typing over.

How can I do this?


You can use the Enter event and
Me.cmbTst.SelStart = 0
Me.cmbTst.SelLength = Len(Me.cmbTst)

BUT, this is usually not a good idea. What if the user just
wants to insert a character or select a portion of the text
to nodify?
 
Marsh,

Thanks very much for your reply.

1. I had to modify it a bit since I have two columns as below.

Note: The only event I could get it to work in was OnMouseUp.

' Highlight control when clicked
Dim intLength As Integer

intLength = Len(Me.ActiveControl.Column(1))
Me.ActiveControl.SelStart = 0
Me.ActiveControl.SelLength = intLength


2. In regard to behavior preferences, user pattern here is to type in
first
few letters of last name to go to desired name. Highlighting current
content of dropdown on enter would allow user to just type first few
letters., instead of having to backspace or cursor to clear existing name
in
dropdown.

A dropdowon box highlights anyway when the little arrow is pressed.

Thanks very much.

Alan
 
Back
Top