Question Reporting with Parameters

ccbryan

Active member
Joined
Oct 14, 2008
Messages
30
Programming Experience
5-10
Hi all. In VB.Net 2013 I am trying to test a simple report, with the data supplied solely by parameters. I have created Report1.rdlc. In its "Report Data" view, under Parameters, I have created four parameters (KComp, KCompLabel, DispPrice, DispPriceLabel). On the report are four textboxes corresponding to the parameters, and their expressions are all like this (with corresponding parameter names of course): =Parameters!KComp.Value

On my form I have ReportViewer1. Under its "Choose Report" I have selected Report1, which is the only .rdlc in my project.

In my form code, to keep it simple, I am explicitly assigning the parameter values like so:

VB.NET:
Imports System
Imports System.IO
Imports System.Data
Imports System.Text
Imports System.Drawing.Imaging
Imports System.Drawing.Printing
Imports System.Collections.Generic
Imports Microsoft.Reporting.WinForms
Imports System.Xml

 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
     
     Dim params(3) As Microsoft.Reporting.WinForms.ReportParameter
     params(0) = New Microsoft.Reporting.WinForms.ReportParameter("KComp", "$444") 
     params(1) = New Microsoft.Reporting.WinForms.ReportParameter("KCompLabel", "COMPARE") 
     params(2) = New Microsoft.Reporting.WinForms.ReportParameter("DispPrice", "$333") 
     params(3) = New Microsoft.Reporting.WinForms.ReportParameter("DispPriceLabel", "OUR PRICE") 
     ReportViewer1.LocalReport.SetParameters(params)
     Me.ReportViewer1.RefreshReport()

End Sub

However this code never makes it to the last line. Upon exectuting the Reportviewer1.localreport.setparameters command it stops and shows the (blank) form with (empty) reportviewer. So I think I have two issues, one programmatic and one in the IDE. Programmatic: why does it bomb out on that line and why don't I have data on my report? and IDE: Why doesn't it put up an error window?

Any help would be vastly appreciated.

Chandler
 
That means that an exception is being thrown. On 64-bit systems, exceptions thrown in the Load event handler are swallowed. You should wrap your code in a Try...Catch block and then you can catch the exception and find out exactly what the issue was.
 
Back
Top