ComboBox1.DropDownStyle= DropDown
ComboBox1.AutoCompleteMode=SuggestAppend
ComboBox1.AutoCompleteSource=ListItems
ó
Private Sub cmb1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cmb1.KeyUp
Dim i As Integer
If e.KeyCode <> Keys.Clear And e.KeyCode <> Keys.Delete And e.KeyCode <> Keys.Back Then
With cmb1
'Recorremos todos los elementos del combo
i = 0
For i = 0 To .Items.Count - 1
'Buscamos coincidencia
If InStr(1, .Items.Item(i), .Text, vbTextCompare) = 1 Then
Dim pos As Integer = .Text.Length
.Text = .Items.Item(i)
.SelectionStart = pos
.SelectionLength = .Text.Length - pos
Exit For
End If
Next i
End With
End If
End Sub
No hay comentarios:
Publicar un comentario