VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Auto fills the combo box as you type in, from the drop down list of the combo box

by Muhammad Musa Ali (6 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 15th November 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Auto fills the combo box as you type in, from the drop down list of the combo box

Rate Auto fills the combo box as you type in, from the drop down list of the combo box



'Private Sub cboEvaluators_Change()
'    Call Proc_ComboAutoFill(cboEvaluators)
'End Sub
' where cboEvaluators is the combo box filled with a list of items

Public Sub Proc_ComboAutoFill(cboCtl As Control)

  Dim i As Integer
  Dim szEntry As String
  
  If cboCtl.SelStart = 0 Then
    szEntry = cboCtl.Text
  Else
    szEntry = left$(cboCtl.Text, cboCtl.SelStart)
  End If
  If IsNull(szEntry) Then Exit Sub
  If cboCtl.ListCount = 0 Then Exit Sub
  Do
  
    i = Func_BinaryListSearch(cboCtl, szEntry)
  
    If i <> -1 Then
     cboCtl.ListIndex = i
     cboCtl.SelStart = Len(szEntry)
     cboCtl.SelLength = Len(cboCtl.List(i)) - Len(szEntry)
      Exit Sub
    Else
      If Len(szEntry) <= 1 Then
        cboCtl.ListIndex = 0
        Exit Sub
      Else
        szEntry = left$(szEntry, Len(szEntry) - 1)
      End If
    End If
      
  Loop
  
End Sub

Download this snippet    Add to My Saved Code

Auto fills the combo box as you type in, from the drop down list of the combo box Comments

No comments have been posted about Auto fills the combo box as you type in, from the drop down list of the combo box. Why not be the first to post a comment about Auto fills the combo box as you type in, from the drop down list of the combo box.

Post your comment

Subject:
Message:
0/1000 characters