我不知道是什么问题,我的笔记中有相同的代码。报表查看器不会加载带有参数的 .rdlc 报表。我有相同的对象名称和参数名称。我在报告查看器的小箭头链接中选择了 .rdlc 报告。所以请放心,它应该将 .rdlc 与报告查看器连接起来,我有以下代码。
导入 Microsoft.Reporting.WinForms
公共类 PrintSingleInfo
Private Sub PrintSingleInfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pn, bn, ad, cn, sr, lt, lb, ls, ln, dd, lp, pc, tb, dp, tp, dr, ir, mp, pt As New ReportParameter
pn = New ReportParameter("PNPANoPar", MemParkInfoSysForm.PNPANoTextBox.Text)
bn = New ReportParameter("BuyerNamePar", MemParkInfoSysForm.BuyerNameTextBox.Text)
ad = New ReportParameter("AddressPar", MemParkInfoSysForm.AddressTextBox.Text)
cn = New ReportParameter("ContactNoPar", MemParkInfoSysForm.ContactTextBox.Text)
sr = New ReportParameter("SalesRepPar", MemParkInfoSysForm.SalesRepTextBox.Text)
lt = New ReportParameter("TypePar", MemParkInfoSysForm.TypeCBO.Text)
ls = New ReportParameter("SectionPar", MemParkInfoSysForm.SectionTextBox.Text)
lb = New ReportParameter("BlockPar", MemParkInfoSysForm.BlockTextBox.Text)
ln = New ReportParameter("LotNoPar", MemParkInfoSysForm.LotNoTextBox.Text)
dd = New ReportParameter("DueDatePar", MemParkInfoSysForm.DueUpDown.Value)
lp = New ReportParameter("LotPricePar", MemParkInfoSysForm.LBLPrice.Text)
pc = New ReportParameter("PerpetualCarePar", MemParkInfoSysForm.LBLPerpCare.Text)
tp = New ReportParameter("TotalLotPricePar", MemParkInfoSysForm.LBLTotLotPrice.Text)
dp = New ReportParameter("DownPaymentPar", MemParkInfoSysForm.DownpaymentTextBox.Text)
tb = New ReportParameter("LotBalancePar", MemParkInfoSysForm.LBLLotBal.Text)
pt = New ReportParameter("PaymentTermsPar", MemParkInfoSysForm.PaymentTermsCBO.Text)
ir = New ReportParameter("InterestRatePar", MemParkInfoSysForm.LBLInterest.Text)
dr = New ReportParameter("DiscountRatePar", MemParkInfoSysForm.LBLDiscount.Text)
mp = New ReportParameter("MonthlyPaymentPar", MemParkInfoSysForm.LBLMonthly.Text)
ReportViewer1.LocalReport.SetParameters(pn)
ReportViewer1.LocalReport.SetParameters(bn)
ReportViewer1.LocalReport.SetParameters(ad)
ReportViewer1.LocalReport.SetParameters(cn)
ReportViewer1.LocalReport.SetParameters(sr)
ReportViewer1.LocalReport.SetParameters(lt)
ReportViewer1.LocalReport.SetParameters(ls)
ReportViewer1.LocalReport.SetParameters(lb)
ReportViewer1.LocalReport.SetParameters(ln)
ReportViewer1.LocalReport.SetParameters(dd)
ReportViewer1.LocalReport.SetParameters(lp)
ReportViewer1.LocalReport.SetParameters(pc)
ReportViewer1.LocalReport.SetParameters(tp)
ReportViewer1.LocalReport.SetParameters(dp)
ReportViewer1.LocalReport.SetParameters(tb)
ReportViewer1.LocalReport.SetParameters(pt)
ReportViewer1.LocalReport.SetParameters(ir)
ReportViewer1.LocalReport.SetParameters(dr)
ReportViewer1.LocalReport.SetParameters(mp)
Me.ReportViewer1.RefreshReport()
End Sub
结束类