Public Class ThreadSearch
Inherits frmStDetails 'Windows form which contains my control
Public Event finishedSearching()
Sub Tsearch()
Try
settings.MoveFirst()
Catch ex As Exception
End Try
'checking filter
If Not Depmt.SelectedIndex = -1 Then
'It's to check only in perticular department
Call openSRS(Depmt.Text, isName)
Call loadSRS()
srs.Close()
Else
While Not settings.EOF
'It check's in all the department
Call openSRS(settings.Fields(1).Value, isName)
Call loadSRS()
srs.Close()
settings.MoveNext()
End While
End If
If Not found Then
ListBox1.Items.Add(search.Text & " is Not found")
ListBox1.Enabled = False
End If
RaiseEvent finishedSearching()
End Sub
End Class
The above code is my thread class.
Private Sub Search_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Search.TextChanged
Dim ts As New ThreadSearch
Dim t1 As New System.Threading.Thread(AddressOf ts.Tsearch)
If t1.IsAlive Then t1.Abort()
AddHandler ts.finishedSearching, AddressOf ts.Tsearch
t1.Start()
End Sub
This is the procedure I used to start the thread. It doesn't generates error but the problem is 'IT DOES NOTHING'.
Please help me.......
Inherits frmStDetails 'Windows form which contains my control
Public Event finishedSearching()
Sub Tsearch()
Try
settings.MoveFirst()
Catch ex As Exception
End Try
'checking filter
If Not Depmt.SelectedIndex = -1 Then
'It's to check only in perticular department
Call openSRS(Depmt.Text, isName)
Call loadSRS()
srs.Close()
Else
While Not settings.EOF
'It check's in all the department
Call openSRS(settings.Fields(1).Value, isName)
Call loadSRS()
srs.Close()
settings.MoveNext()
End While
End If
If Not found Then
ListBox1.Items.Add(search.Text & " is Not found")
ListBox1.Enabled = False
End If
RaiseEvent finishedSearching()
End Sub
End Class
The above code is my thread class.
Private Sub Search_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Search.TextChanged
Dim ts As New ThreadSearch
Dim t1 As New System.Threading.Thread(AddressOf ts.Tsearch)
If t1.IsAlive Then t1.Abort()
AddHandler ts.finishedSearching, AddressOf ts.Tsearch
t1.Start()
End Sub
This is the procedure I used to start the thread. It doesn't generates error but the problem is 'IT DOES NOTHING'.
Please help me.......
Last edited: