473,395 Members | 1,762 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,395 software developers and data experts.

NullReferenceException when using crystalReportViewer.ReportSource

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 'System.ExecutionEngineException'
occurred in mscorlib.dll

If I put the following statement inside a try catch block, it gives me
a
NullReferenceException. I have checked oReport to see that it has data.
Please help me with this.

Thanks for your help

Aug 15 '06 #1
3 4866
roopsd wrote:
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 'System.ExecutionEngineException'
occurred in mscorlib.dll

If I put the following statement inside a try catch block, it gives me
a
NullReferenceException. I have checked oReport to see that it has data.
Please help me with this.

Thanks for your help
Can you post some of your code please?
Aug 15 '06 #2
The following line is where it errors giving a null reference
exception:
oRptForm.crystalReportViewer.ReportSource = oReport

I have tried binding the oDataSet to a datagrid, it does show me 2
tables of values.

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


roopsd wrote:
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 'System.ExecutionEngineException'
occurred in mscorlib.dll

If I put the following statement inside a try catch block, it gives me
a
NullReferenceException. I have checked oReport to see that it has data.
Please help me with this.

Thanks for your help
Aug 16 '06 #3
Hi!
Thank you for looking at it.

I get a NullReferenceException at the following line:
oRptForm.crystalReportViewer.ReportSource = oReport

I have tried binding the oDataset to datagrid to make sure it has data,
it does show 2 tables with data.

Please advice what I should do.

Thank you.
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

Ray Booysen wrote:
roopsd wrote:
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 'System.ExecutionEngineException'
occurred in mscorlib.dll

If I put the following statement inside a try catch block, it gives me
a
NullReferenceException. I have checked oReport to see that it has data.
Please help me with this.

Thanks for your help
Can you post some of your code please?
Aug 16 '06 #4

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

Similar topics

1
by: JK | last post by:
In my win form, I'm trying to display a Crystal report with the data in my dataset only but, if I follow the steps in this msdn page: ...
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...
7
by: TJoker .NET | last post by:
I'm developing an VB.NET Windows Forms application that uses CR for VS.NET (original version shipped with VS.NET 2002 - my VS.NET has the latest SP installed, no SPs for CR). My reports get their...
1
by: dan_williams | last post by:
Is it possible to pass multiple discrete values to a report document so that I can export it to PDF? I've managed to perform the following code to display a Crystal Report Viewer ok, but i want...
0
by: roopsd | last post by:
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 =...
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...
0
by: dancho | last post by:
hi to All.... Can anybody help me? I want two reports (with two parmeters @p1 and @p2) in one CrystalReportViewer... But I don't understand my mistake: Dim prF As New ParameterField Dim...
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.