'Although it is a minor aesthetic issue, when I have a dropdown list I do
'not like to see the text highlighted either at the program start or after
'selecting a list item. Most of the time I also have the keypress() method
'set keyascii to 0 as I rarely use these as input fields. Below is the code
'that uses a timer control as a one-shot outside of the list box execution:
'It is fast, keeps the focus in the list control and does not use cycles unless
'it actually needs to clear the highlight.

Public Sub uhl(index As Integer)
'This un-highlights the text in ComboBox controls set as a DropdownCombo. It
'only works on a "DropdownCombo" because the "DropdownList" does not actually
'have the SelLength property. The timer is set to 1mS and is active only
'once per list box event (As opposed to constantly monitoring/unhighlighting
'the list box: This would not do for real time loaded apps!)
'Put "Call uhl(index)" in the click(), change(), dbl_click(), got_focus() and
'scroll() methods of any combo lists to un-highlight.
'(index) tells uhl() which control to update.
'This needs to be done as the last external execution of these methods as any
'call outside of the method re-highlights the text on its return as if it was
'a new got focus event.
Static uhlindex As Integer
Select Case index
Case -1
'Called by the timer, this is not called by the list box and so can
'actually unhighlight the text.
Select Case uhlindex
Case 0
combo0.SelLength = 0
Case 1
combo1.SelLength = 0
End Select
'the timer is turned off
uhltimer.Enabled = False
Case Else
'Called by the list box, this saves the index and enables the timer.
'This essentially triggers an independent process outside of the list box
'to do the un-highlight.
'save the index
uhlindex = index
'set the timer interval to 1ms and turn it on
uhltimer.Interval = 1
uhltimer.Enabled = True
End Select
End Sub

Private Sub uhltimer_Timer()
'This calls another instance of UHL() to do the actual un-highlighting
Call uhl(-1)
End Sub