CrystalReport - Search And Highlight Text
I have an ASP application that displays a Crystal Report. It is my understanding that there is a function that will allow to search for a text in the report (maybe I'm wrong?). If so, I am trying to get below code to work:
Code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mySearchMessage As String
Try
Dim mySearchResult As Boolean = CrystalReportViewer1.SearchAndHighlightText(TextBox1.Text, SearchDirection.Forward)
If mySearchResult = True Then
mySearchMessage = "Search for " & TextBox1.Text & " successful"
Else
mySearchMessage = "Search for " & TextBox1.Text & " not successful"
End If
Catch ex As Exception
Message = ex.ToString
End Try
End Sub
Here is what is happening after I display the report and I enter a search text and click the button:
1. Search result is always = False
2. I get error: Object reference not set to an instance of an object.