Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Tutorial "Reading and Setting Discrete Parameters" fails intermittantly

I am using Visual Studio.Net 2003 with Crystal Reports 2008 (30 day evaluation) and writing a windows forms app in C++.

I ran through the tutorial and got it work quite nicely - or so I thought.

Once I had gone through the tutorial I made my own application doing pretty much exactly the same thing and sort of got this working too.

I say "sort of" because it doesn't always work. After fighting with it for some time I went back to the tutorial app and found that it has the same problem.

The report loads and runs but when I select Cities from the ListBox and click the "Redisplay Reports" button again and again, it eventually fails with an error "Load Report Failed". Sometimes it happens quite quickly (like the 3rd attempt) but other times it can take 10 minutes of trying before it fails.

On my own app it breaks a bit more frequently but is also completely intermittant.

The code where it is having a problem is here:

private: System::Void redisplay_Click(System::Object * sender, System::EventArgs * e)


ArrayList* arrayList = new ArrayList();

IEnumerator* myEnumerator = defaultParameterValuesList->SelectedItems->GetEnumerator();

while ( myEnumerator->MoveNext() )


String* item = dynamic_cast<String*>( myEnumerator->Current );

arrayList->Add( item );


String* reportPath = String::Concat( Application::StartupPath, S"
", S"CustomersByCity.rpt" );

crystalReportViewer->ReportSource = reportPath;

ParameterFields* parameterFields = crystalReportViewer->ParameterFieldInfo; // This is the line of code which fails!!!!!!!

SetCurrentValuesForParameterField( parameterFields, arrayList );


When the error "Load Report Failed" is displayed, I click ok, and it usually pops up again, click ok again and it breaks in the code. I trace it back to the 2nd last line of code above where I find parameterFields is undefined.

I sometimes get another problem on the same line of code - when I click the button (to run this code) the application sometimes freezes - breaking into the application I always find that it is sitting waiting for the call crystalReportView->ParameterFieldInfo to return.

So it looks to me like the problem is inside the CrystalReportViewer object.

This is extremely annoying and I can't seem to find a solution for it, can anyone help?

Former Member

Perhaps a better way to approach this is to download a few sample apps and see how things work there. There is a number of samples in [this|]

self extracting executable.

In particular have a look at vbnet_win_paramengine. Leave out the arrays for now, just hard code things.

There are more samples here:

and here:

And I often find this White Paper useful:


0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question