'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)<br>
'Add 1 Combo Box to your form. Set the Combo Box Style property to 2 - DropDown List.<br>
'Add few items to the Combo Box list, some of them should begin with the same character.<br>
'When you will press a key, the first item that begins with the key you pressed will be selected.<br>
'If you will press the same key again, the second item that begins with the key you pressed <br>
'will be selected.<br>
'Insert the following code to the module :<br>
<br>
Dim strCombo As String<br>
Const WM_SETREDRAW = &HB<br>
Const KEY_A = 65<br>
Const KEY_Z = 90<br>
Declare Function SendMessage Lib "User32" (ByVal hWnd As Integer, ByVal wMsg As _<br>
Integer, ByVal wParam As Integer, lParam As Any) As Long<br>
<br>
'Insert the following code to your form:<br>
<br>
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)<br>
Dim x%<br>
Dim strTemp$<br>
Dim nRet&<br>
If KeyCode >= KEY_A And KeyCode <= KEY_Z Then<br>
'only look at letters A-Z<br>
strTemp = Combo1.Text<br>
If Len(strTemp) = 1 Then strCombo = strTemp<br>
nRet& = SendMessage(Combo1.hWnd, WM_SETREDRAW, False, 0&)<br>
For x = 0 To (Combo1.ListCount - 1)<br>
If UCase((strTemp & Mid$(Combo1.List(x), Len(strTemp) + 1))) = UCase(Combo1.List(x)) Then<br>
Combo1.ListIndex = x<br>
Combo1.Text = Combo1.List(x)<br>
Combo1.SelStart = Len(strTemp)<br>
Combo1.SelLength = Len(Combo1.Text) - (Len(strTemp))<br>
strCombo = strCombo & Mid$(strTemp, Len(strCombo) + 1)<br>
Exit For<br>
Else<br>
If InStr(UCase(strTemp), UCase(strCombo)) Then<br>
strCombo = strCombo & Mid$(strTemp, Len(strCombo) + 1)<br>
Combo1.Text = strCombo<br>
Combo1.SelStart = Len(Combo1.Text)<br>
Else<br>
strCombo = strTemp<br>
End If<br>
End If<br>
Next<br>
nRet& = SendMessage(Combo1.hWnd, WM_SETREDRAW, True, 0&)<br>
End If<br>
End Sub<br>
<br>
<p>Eric De Decker<br><a href=mailto:vbg.be@vbgroup.nl>vbg.be@vbgroup.nl</a><br><a href=
Visual Basic Center</a><br>