473,326 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

NullReferenceException when binding to crystalReportViewer.ReportSource

Hi

Thank you for yuour help.

I am using VS.NET 2003 with Crystal XI r2. I am getting
NullReferenceException at the following line in my code.
oRptForm.crystalReportViewer.ReportSource = oReport

I did bind the oDataset with a datagrid to make sure it has data and it
does show 2 tables with data.

Please help me with this.
Private Sub btnShowReport_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnShowReport.Click

Dim oDataSet As New ProductivityDataSet()
Dim oReport As New Productivity()
Dim oProductivityReport As New
GsaVoldrBiz.ProductivityReport()
Dim oRptForm As ImmWinForms.ReportViewer

Status.ShowStatus("Generating Productivity Report...")
Me.Cursor = Cursors.WaitCursor

oProductivityReport.GetProductivityReport(oDataSet ,
dtpStartDate.Value, dtpEndDate.Value)
If oDataSet.Productivity.Rows.Count 0 Then
Status.ShowStatus("Loading Productivity Report...")
oReport.SetDataSource(oDataSet)
oReport.SummaryInfo.ReportTitle = "Productivity Report"
oReport.SummaryInfo.ReportComments = "Start Date: " &
dtpStartDate.Text & " End Date: " & dtpEndDate.Text
'Create the Report Form
oRptForm =
ImmWinApplication.AddForm("ProductivityReport",
GetType(ImmWinForms.ReportViewer))

'Set the properties of the Report Form
oRptForm.Text = "Productivity Report"
oRptForm.crystalReportViewer.ShowCloseButton = False
oRptForm.crystalReportViewer.ShowGroupTreeButton =
False
oRptForm.crystalReportViewer.DisplayGroupTree = False
'oRptForm.crystalReportViewer.ReportSource = oReport
Try
DataGrid1.DataSource = oDataSet

oRptForm.crystalReportViewer.ReportSource = oReport
Catch ex As NullReferenceException

End Try
'Me.Cursor = Cursors.Default
'Status.HideStatus()
'Me.Close()
Else
Me.Cursor = Cursors.Default
Status.HideStatus()
MessageBox.Show("There are no records to report on,
please adjust your query and try again", "Search Results",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If

End Sub
End Class

End Namespace

Aug 16 '06 #1
0 1313

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: mcs04 | last post by:
I'm writing this post because I need some help. Any insight will be greatly appreciated. Thank you in advance! I have a Crystal Report 9 that gets its info from a SQL database. I installed the...
3
by: Reza Nabi | last post by:
Hello I created a very simple page just to load a crystal report which was working just great Code started throwing the following exception, after I installed crystal report 9 advanced edition ...
1
by: Richard | last post by:
I keep getting this error and i dont know how 2 fix it. If someone knows how, please tell me :D Compilation Error Description: An error occurred during the compilation of a resource required to...
0
by: Marc Callec | last post by:
I'm trying to create an instance of the CrystalReportViewer control within my class in an attempt to return the rendered HTML back to the consumer of the class. Because I haven't added the...
0
by: Tumurbaatar S. | last post by:
It's my first project using the Crystal report. I created a report with the report designer and linked it to a web form as: 1. put CrystalReportViewer in my page (its ID: Viewer). 2. put...
3
by: roopsd | last post by:
I am using VS.NET 2003 with crystal reports XI release 2. I get a runtime error at the following line: oRptForm.crystalReportViewer.ReportSource = oReport An unhandled exception of type...
0
by: Rod | last post by:
I've upgraded a Visual Studio .NET 2003 app (C#) to Visual Studio .NET 2005. It is a WinForms application, and it uses Crystal Reports 11 Release 2. After going through the upgrade process with the...
0
by: Rod | last post by:
I've got Crystal Reports XI Release 2, for development with Visual Studio ..NET 2005. I've taken a VS .NET 2003 WinForms application that I wrote in C#, and upgraded it to VS .NET 2005. It has...
1
by: mejames | last post by:
I am using VB.NET 2003, MYSQL database and Crystal Reports. I am able to generate 1 set of reports using the following code: Imports MySql.Data.MySqlClient Imports...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.