codice:Sub SearchInCombo(Combo1 As Control) Dim col() As String Dim cnt As Integer Dim i As Integer ctext = Combo1.Text If ctext = "" Then Exit Sub ReDim col(Combo1.ListCount) For cnt = 0 To Combo1.ListCount - 1 col(cnt) = Combo1.List(cnt) Next ctextl = LCase(Combo1.Text) curpos = Combo1.SelStart clen = Len(ctext) For cnt = 0 To UBound(col) wit = col(cnt) If LCase(wit) Like ctextl & "*" Then With Combo1 .Text = .Text & Right(col(cnt), Len(col(cnt)) - clen) For i = 0 To .ListCount - 1 If UCase(.List(i)) = UCase(.Text) Then .ListIndex = i Next .SelStart = curpos .SelLength = Len(.Text) End With Exit Sub End If Next End Sub

Rispondi quotando