简体   繁体   中英

vb2005 crystal reports : Name 'CrystalReportViewer1' is not declared error

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.

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.

Key part of the tutorial

and drag a button and CrystalReportViewer control to your form.

Get rid of this:

Dim CrystalReportViewer1 as new CrystalReport1

You need to add the crystal report viewer control and it will automatically call it "CrystalReportViewer1"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM