Skip to Content
Former Member
Jun 18, 2009 at 09:46 AM

Load Report Failure error


I have a combobox (windows app c# VS2005 CR XI R2) when I change selection I want the appropriate report to be displayed. It only works first time!

If I run in debug mode and break on SelectedIndexChanged and then press F5 to continue it will work, but if I just run it without this manual intervention, I get an unhandled exception, the inner exception shows 'Object reference not set to an instance of an object'

The code is paused on the line:

AtWrpt.SetParameterValue("@P1ID", cmbNames.SelectedValue.ToString());

When I hover over Selected Value it has a value, so what Object is not set?

Here's the pertinent bits of code...

//Class variables

private rptAtW AtWrpt;

private ConnectionInfo connectionInfo;

private void cmbNames_SelectedIndexChanged(object sender, EventArgs e) {

AtWrpt = new rptAtW();

//CRV is the Crystal Reports Viewer on the form

CRV.ReportSource = AtWrpt;

AtWrpt.SetParameterValue("@P1ID", CmbNames.SelectedValue.ToString());

AtWrpt.SetParameterValue("@InclusionType", 1);



private void ConfigureCrystalReports() {

connectionInfo = new ConnectionInfo();


connectionInfo.DatabaseName = "xx";

connectionInfo.IntegratedSecurity = true;


private void SetDBLogonForReport(ReportDocument reportDocument) {

Tables tables = reportDocument.Database.Tables;

foreach(CrystalDecisions.CrystalReports.Engine.Table table in tables) {

TableLogOnInfo tableLogonInfo = table.LogOnInfo;

tableLogonInfo.ConnectionInfo = connectionInfo;




How do I fix this?

I tried adding a timer delay but that didn't work, do I need to clear somethin out before I get the next report?