Trying to display a crystal report in the viewer

diverdan

Active member
Joined
Jan 2, 2006
Messages
34
Location
London UK
Programming Experience
Beginner
Hi there,

I have been using vb.net for the last few weeks so I am very new to it.

I have managed to create a report and I have also added a ReportViewer onto a form.

I am trying to get the viewer to work but I am having no luck.


This is the code that im trying to get working
VB.NET:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim MonthlySales As New Customer
        Dim strCustomerID As String

        strCustomerID = "1"
        MonthlySales.SetParameterValue("CustomerID", strCustomerID)
        CrystalReportViewer1.ReportSource() = MonthlySales
        CrystalReportViewer1.Refresh()

    End Sub
Can anyone please help me out...
 
Code looks good as long as these things are true:

The report is actually named Customer
(I usually name reports like rptSomeName to designate a report)

There is actually a parameter named
CustomerID on the report (exact spelling)

Change:
CrystalReportViewer1.ReportSource() = MonthlySales
To:
CrystalReportViewer1.ReportSource = MonthlySales

Let me know if you are getting a specific error or what is actually happenning (blank report or something)
 
Back
Top