VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Auto Fill of Combo Box (Part 2) This is the function which I forgot to put in my earlier code

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 Fill of Combo Box (Part 2) This is the function which I forgot to put in my earlier code

Rate Auto Fill of Combo Box (Part 2) This is the function which I forgot to put in my earlier code




  Dim MidPt As Integer
  Dim LoPt As Integer
  Dim HiPt As Integer
  Dim CmpVal As Integer
  
  LoPt = 0
  HiPt = ctlList.ListCount
  
  Do While LoPt < HiPt
    
    MidPt = LoPt + (HiPt - LoPt) \ 2
    
    CmpVal = StrComp(UCase$(left$(ctlList.List(MidPt), Len(szSearch))), UCase$(szSearch))
    
    If CmpVal = 0 Then
      Exit Do
    ElseIf CmpVal = 1 Then
      HiPt = MidPt
    Else
      LoPt = MidPt + 1
    End If
  
  Loop
    
  If CmpVal = 0 Then
    Do
      MidPt = MidPt - 1
      
      If MidPt < 0 Then
        MidPt = 0
        Exit Do
      End If
      
      If UCase$(left$(ctlList.List(MidPt), Len(szSearch))) <> UCase$(szSearch) Then
        MidPt = MidPt + 1
        Exit Do
      End If
    Loop
    
  Else
    MidPt = -1
  End If
  
  Func_BinaryListSearch = MidPt
  
End Function

Download this snippet    Add to My Saved Code

Auto Fill of Combo Box (Part 2) This is the function which I forgot to put in my earlier code Comments

No comments have been posted about Auto Fill of Combo Box (Part 2) This is the function which I forgot to put in my earlier code. Why not be the first to post a comment about Auto Fill of Combo Box (Part 2) This is the function which I forgot to put in my earlier code.

Post your comment

Subject:
Message:
0/1000 characters