选择rdlc报告运行时 [英] select rdlc report runtime

查看:146
本文介绍了选择rdlc报告运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了2个报告1是billa4.rdlc,第2个是billa5我只想在用户选择选项a4或a5时加载这两个报告。我目前的代码是



尝试
Dim P2 As New ReportParameter(pbillnum,billnoprint)
Me.DataTable1TableAdapter .Fill(Me.billdata.DataTable1,billnoprint)
Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter(){P2})
Me.ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)
Me .ReportViewer1.ZoomMode = ZoomMode.FullPage
Me.ReportViewer1.RefreshReport()

Catch ex As Exception
MsgBox(error)
End Try





这里我的billa4.rdlc正在加载,但我想要一个代码,所以我可以动态地将billa4更改为billa5.rdlc。

解决方案

您可以使用

 Me.ReportViewer1.LocalReport.LoadReportDefinition(stream)

来加载报告流

或使用

从文件加载的Me.ReportViewer1.LocalReport.ReportPath(sPath)

<无线电通信/>


更新:

 Me.ReportViewer1.LocalReport.ReportPath = sPath 


i created 2 reports 1 is billa4.rdlc and 2nd is billa5 i just want to load these two reports when user selects the options a4 or a5 . my current code is

Try
          Dim P2 As New ReportParameter("pbillnum", billnoprint)
          Me.DataTable1TableAdapter.Fill(Me.billdata.DataTable1, billnoprint)
          Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter() {P2})
          Me.ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)
          Me.ReportViewer1.ZoomMode = ZoomMode.FullPage
          Me.ReportViewer1.RefreshReport()

      Catch ex As Exception
          MsgBox("error")
      End Try



here my billa4.rdlc is loading but i want a code so i can dynamically change the billa4 to billa5.rdlc .

解决方案

You could use

Me.ReportViewer1.LocalReport.LoadReportDefinition(stream)

to load the stream of the report
or use

Me.ReportViewer1.LocalReport.ReportPath(sPath)

to load from file

UPDATE:

Me.ReportViewer1.LocalReport.ReportPath = sPath


这篇关于选择rdlc报告运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆