Hi

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?

MAny thanks

This error occurs when 'New' has not been used to initialize an object. But there could be another possibility..Comment this line and see..
lstResults.Items.Clear()

Regards
Sunil Punjabi
<URL snipped>