sir,
I have a problem that I have a list box ,in which i have the nemes e.g.ajay,abhay,abhinav,bani,coma,naveen etc. and have a text box for searching the name in the text box.When i press the a,it will show ajay,abhay and the abhinav.Which is good.when i add ab in text box,it will show abhay and abhinav,which is also right,but when I backspace the ab to a,then it will not show the names ajay,abhay and the abhinav,but it will show the abhay and the abhinav.Perhaps u understand my problem.My code is
Private Sub txtSearch1_Change()
Dim intloopindex As Integer
Dim charPos As Integer
Dim intcount As Integer
Dim strvariable() As String
If Len(txtSearch1.Text) = 0 Then
lstUserinfo.Clear
Call Form_Load
Exit Sub
End If
If lstUserinfo.ListCount > 0 Then
ReDim strvariable(0)
Dim i As Integer
Dim j As Integer
For i = lstUserinfo.ListCount - 1 To 0 Step -1
If (InStr(1, lstUserinfo.List(i), txtSearch1.Text, vbTextCompare) = 1) Then
strvariable(j) = lstUserinfo.List(i)
j = j + 1
ReDim Preserve strvariable(j)
End If
Next
lstUserinfo.Clear
For j = 0 To UBound(strvariable) - 1
lstUserinfo.AddItem strvariable(j)
Next
End If
.
Please help me..............