Vb.net – vb2005 crystal reports : Name ‘CrystalReportViewer1’ is not declared error

crystal-reportsvb.netvisual-studio-2005

I'm running through this tutorial found here:

http://vb.net-informations.com/crystal-report/vb.net_crystal_report_from_multiple_tables.htm

which teaches how to pass a parameter text field on a vb form to an embedded Crystal Report in visual studio.

I've followed it all the way through however when I attempt to build, I received the error:

Name 'CrystalReportViewer1' is not
declared.

So I add the line to the sub button1_click

Dim CrystalReportViewer1 as new CrystalReport1 

so i have

Dim cryRpt As New ReportDocument
cryRpt.Load("c:\path\CrystalReport1.rpt")
Dim CrystalReportViewer1 As New CrystalReport1
CrystalReportViewer1.ReportSource =  cryRpt
CrystalReportViewer1.Refresh()

and then I'm ending up with a build error:

> Reference required to assembly
> 'CrystalDecisions.ReportAppServer.Controllers,Version=10.2.3600,
> Culture=neutral,
> PublicKeyToken=692fbea5521e'
> containing the type
> 'CrystalDecisions.ReportAppServer.Controllers.ReportSource'.
> Add one to your project.

I go to Project >> Add Reference and I can't find this library.

Am I approaching this incorrectly?

thanks in advance

Note: I did check in the help >> about to ensure that Crystal Reports for Visual Studio 2005 was installed.

Best Answer

One problem I suspect is that you're creating the CrystalReportViewer object (your CrystalReportViewer1) incorrectly.

Rather than creating this object via declaration in your code, perhaps you need to create one by dragging and dropping the control onto your form's design surface from the toolbox.

Related Topic