Sorry if this is handled in the book. I have ordered one, it just has yet to arrive.
In Asp.net for VB.. I am trying to get the export to pdf to work. I am following a tutorial of how to get it to work from a C# example that did work.
In VB I get no compilation error. But, when running I get the following error.
"Object Reference not set to an instance of the object."
I do rebind during a postback, and watching in debug it does hit the code. This fixed other navigation errors, so I know it to be working.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
BindReport()
Else
CrystalRpt =
CType(Session("CrystalRpt"), CrystalDecisions.CrystalReports.Engine.ReportDocument)
End If
CrystalReportViewer1.ReportSource = CrystalRpt
End Sub
But in the following code I get the error, which seems to me, It doesn't think I have rebound the data..
' Stop buffering the response
Response.Buffer =
False
' Clear the response content and headers
Response.ClearContent()
Response.ClearHeaders()
Try
' Export the Report to response stream in PDF format and file name Customers
CrystalRpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response,
True, "Customers_rptName")
' There are other format options available such as word, Excel, CVS, and html in the ExportFormatType
' Enum given by crystal reports
Catch exp As Exception
MsgBox(exp.Message)
End Try
TIA to anyone who can help..