Microsoft报告的参数

时间:2014-12-03 16:28:41

标签: vb.net parameters reportviewer

为什么它不会使用此代码向表单2上的reportviewer显示参数。

Imports Microsoft.Reporting.WinForms
Public Class Report
Private Sub Report_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Dim parmlist As New List(Of ReportParameter)()
    parmlist.Add(New ReportParameter("CompanyName ", Form1.TextBox1.Text & "Report"))
    parmlist.Add(New ReportParameter("ClientName", Form1.TextBox2.Text))
    parmlist.Add(New ReportParameter("ClientAdress", Form1.TextBox3.Text))

    ReportViewer1.LocalReport.SetParameters(parmlist)

    Me.ReportViewer1.RefreshReport()
    End Sub
End Class

代码没有显示问题。我还添加了具有相同值的参数,并设计为图片。 Image

1 个答案:

答案 0 :(得分:0)

通过使用此代码,它可以完美运行。

 Dim ime As New ReportParameter("CompanyName", Form1.TextBox1.Text) 
    Dim imec As New ReportParameter("ClientName", Form1.TextBox2.Text) 
    Dim adresa As New ReportParameter("ClientAdress", Form1.TextBox3.Text)  
    ReportViewer1.LocalReport.SetParameters(ime)     
    ReportViewer1.LocalReport.SetParameters(imec) 
    ReportViewer1.LocalReport.SetParameters(adresa) 
    Me.ReportViewer1.RefreshReport()