Implementar el auto-completar en un ComboBox
Artículo por Club Developers · 11 May 2006
2269 vistas
Tenemos que llamar al método FindString en el evento TextChanged del ComboBox:
vbnet
Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.TextChanged If Me.ComboBox1.FindString(Me.ComboBox1.Text) > 0 Then Dim Pos As Int32 = Me.ComboBox1.Text.Length Me.ComboBox1.SelectedIndex = Me.ComboBox1.FindString(Me.ComboBox1.Text) Me.ComboBox1.SelectionStart = Pos Me.ComboBox1.SelectionLength = Me.ComboBox1.Text.Length - Pos End If End Sub