I have a dataset which is popultaed with data from a text file, which in turn then populates a datagrid. This all works fine.
What im trying to do is search within the dataset based on a value input into a text box.
But everytime i do the search i keep gettign the error:
Object reference not set to an instance of an object.
The code i am using for the search is this:
Dim re As String Dim s As String Dim i As Integer Dim TotalRows As Integer TotalRows = dt.Rows.Count s = LCase(txtSearch.Text) lstResults.Items.Clear() For i = 1 To TotalRows re = ds.Tables("CdrData").Rows(i).Item(5) If InStr(LCase(re), s) Then lstResults.Items.Add(ds.Tables("CdrData").Rows(i).Item(1)) End If Next
I ust cant see what the problem is?