Combo Box Return to First in List

M

Michael I

If I have a combo box (created by control toolbar), is there a way to set it so that when the pull down is selected, it displays the top entry in the list instead of the the most recently selected item.
 
D

Dave Peterson

This seemed to work ok for me (in minor testing):

Option Explicit
Private Sub ComboBox1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

Me.ComboBox1.ListIndex = -1

End Sub

Go into Design mode and double click on that combobox. Then paste this code
in. (Adjust the procedure name to match your combobox name--or better, use the
dropdown at the top of the code window to choose your combobox and then choose
the _mousedown event.)

(You will have to change this line:
Me.ComboBox1.ListIndex = -1
to match the name.)
 
M

Michael I

Thanks Dave, That did the trick

----- Dave Peterson wrote: ----

This seemed to work ok for me (in minor testing)

Option Explici
Private Sub ComboBox1_MouseDown(ByVal Button As Integer,
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single

Me.ComboBox1.ListIndex = -

End Su

Go into Design mode and double click on that combobox. Then paste this cod
in. (Adjust the procedure name to match your combobox name--or better, use th
dropdown at the top of the code window to choose your combobox and then choos
the _mousedown event.

(You will have to change this line
Me.ComboBox1.ListIndex = -
to match the name.

Michael I wrote
 
Top