- Home
·
- Miscellaneous
·
- Orginal written by Muhammad Musa Ali then simplified by me. This is a simplified Combo Box Auto Fil
Orginal written by Muhammad Musa Ali then simplified by me. This is a simplified Combo Box Auto Fil
Orginal written by Muhammad Musa Ali then simplified by me. This is a simplified Combo Box Auto Fill
API Declarations
In the combobox change event do this
Proc_ComboAutoFill cboYourCombo
Rate Orginal written by Muhammad Musa Ali then simplified by me. This is a simplified Combo Box Auto Fil
(1(1 Vote))
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) Or Len(szEntry) < 1 Then Exit Sub
If cboCtl.ListCount = 0 Then Exit Sub
i = Func_ListSearch(cboCtl, szEntry)
If i <> -1 Then
cboCtl.ListIndex = i
cboCtl.SelStart = Len(szEntry)
cboCtl.SelLength = Len(cboCtl.List(i)) - Len(szEntry)
Exit Sub
Else
cboCtl.Text = szEntry
Exit Sub
End If
End Sub
Private Function Func_ListSearch(ctlList As Control, szSearch As String) As Integer
Dim LoPt As Integer
Dim HiPt As Integer
Dim CmpVal As Integer
LoPt = 0
HiPt = ctlList.ListCount
Do While LoPt < HiPt
CmpVal = StrComp(UCase$(Left$(ctlList.List(LoPt), Len(szSearch))), UCase$(szSearch))
If 0 = CmpVal Then
Exit Do
Else
LoPt = LoPt + 1
End If
Loop
If CmpVal <> 0 Then
LoPt = -1
End If
Func_ListSearch = LoPt
End Function
Orginal written by Muhammad Musa Ali then simplified by me. This is a simplified Combo Box Auto Fil Comments
No comments yet — be the first to post one!
Post a Comment