VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Begin finding in list box when you begin typing in Textbox Without any API use. Very easy and with

Dipen Anovadia  (19 Submissions)   Custom Controls/Forms/Menus   Visual Basic 5.0   Unknown Difficulty   Fri 7th April 2006   Mon 8th February 2021

Begin finding in list box when you begin typing in Textbox Without any API use. Very easy and with only one procedure...!

API Declarations


Public Function IndexFromText(lb As ListBox, sFind As String, Optional bCaseSensitive As Boolean = False, Optional bMatchFull As Boolean = False, Optional bNoneOnBlank As Boolean = False, Optional lOUT_Error As Long = 0) As Long

On Error GoTo errIFT

Dim l As Long, lLen As Long
Dim s As String

IndexFromText = -2

If lb Is Nothing Then Exit Function
If lb.ListCount = 0 Then Exit Function

If sFind = "" Then
If bNoneOnBlank Then IndexFromText = -1
Exit Function
End If

lLen = Len(sFind)

For l = 0 To lb.ListCount - 1
s = lb.List(l)
If Len(s) >= lLen Then
If bCaseSensitive Then
If bMatchFull Then
If s = sFind Then
IndexFromText = l
Exit For
End If
Else
If Left(s, lLen) = sFind Then
IndexFromText = l
Exit For
End If
End If
Else
If bMatchFull Then
If UCase(s) = UCase(sFind) Then
IndexFromText = l
Exit For
End If
Else
If UCase(Left(s, lLen)) = UCase(sFind) Then
IndexFromText = l
Exit For
End If
End If
End If
End If
Next l

Exit Function
errIFT:
lOUT_Error = Err.Number
Err.Clear
IndexFromText = -3
End Function


Rate Begin finding in list box when you begin typing in Textbox Without any API use. Very easy and with (2(2 Vote))
Begin finding in list box when you begin typing in Textbox Without any API use. Very easy and with .bas

Begin finding in list box when you begin typing in Textbox Without any API use. Very easy and with Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters