Select combo box default on focus

  • Thread starter Thread starter Jim Orson
  • Start date Start date
J

Jim Orson

Greetings!

I have a combo box set to display a default value (which is what I want).
However, when I tab to the combo box, the cursor is at the end of the text.
I would like to have the entire text highlighted when I tab to the combo box
so I can change the text easily with the keyboard if necessary. How can I
automatically select the entire text in the combo box when it receives the
focus? BTW, the default value is only a few characters wide.

Thanks

Jim...
 
You have two options here. The first one will affect all controls.

1) Go to Tools|Options|Keyboard tab and choose the appropriate selection
under Behavior Entering Field.

2) In the GotFocus or Enter event use something like this:

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