views:

459

answers:

2

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.

A: 

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.

Jay Riggs
I just deleted the reportviewer control and realized there are two Reportviewer options. One under the Data section and another under All Windows Forms. I'm guessing these are the same; however i'm wondering am I supposed to drag and drop a ReportViewer tool from a Crystal Reports section?
phill
I think you've confused ReportViewer in the Data tab of the toolbox) and CrystalReportViewer in the Crystal Report tab. Go with the CrystalReportViewer. As you probably know they're two different controls.
Jay Riggs
I'm not seeing the CrystalReportViewer in the Toolbox. Is there is an option I need to enable to make this available?
phill
I figured it out, I had to right click on the toolbox tab and enable it to appear in the toolbox.
phill
A: 

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"

DJ