问题描述
我正在使用visual studio 2012在c#中进行一个项目。我想从一个表单中准备RDLC报告,然后将其发送到另一个表单的报表查看器控件。因此,我只对所有报告使用一个报告查看器控件。我在VB.net中使用RDLC和Crystal Report在此过程中完成了数千个报告。但我不能在使用RDLC的c#中做到这一点。以下是我在VB.net中所做的事情。
Dim objreport As new frmReportViwer
Dim rds As ReportDataSource = New ReportDataSource(dsReportData ,dt)
objreport.rvrReportViwer.LocalReport.DataSources.Clear()
objreport.rvrReportViwer.LocalReport.DataSources.Add(rds)
objreport.rvrReportViwer.RefreshReport()
objreport.Show()
我无法访问C#中其他表单的报表查看器控件。任何人都可以帮助我吗?
我尝试过:
我尝试如下 -
public SaleSlipViwer objreportviwer = null; // SaleSlipViwer是我放置报告查看器的形式
公共PointOfSale()
{
InitializeComponent();
objreportviwer = new SaleSlipViwer();
}
然后尝试以这种方式访问ReportViewer
objreportviwer .rvrReportViwer.LocalReport.DataSources.Clear();
但它不起作用。
I am doing a project in c# using visual studio 2012. I want to prepare RDLC report form one form and the send it to report viewer control which is in another form. So that I use only one report viewer control for all reports. I did thousands of reports following this process in VB.net using RDLC and Crystal Report. But I can not do this in c# using RDLC. Following is what I did in VB.net.
Dim objreport As New frmReportViwer
Dim rds As ReportDataSource = New ReportDataSource("dsReportData", dt)
objreport.rvrReportViwer.LocalReport.DataSources.Clear()
objreport.rvrReportViwer.LocalReport.DataSources.Add(rds)
objreport.rvrReportViwer.RefreshReport()
objreport.Show()
I can not access report viewer control of other form in C#. Can any one help me?
What I have tried:
What I tried as follow-
public SaleSlipViwer objreportviwer = null; // SaleSlipViwer is the form in which I placed the report viewer
public PointOfSale()
{
InitializeComponent();
objreportviwer = new SaleSlipViwer();
}
And then try to access ReportViewer this way
objreportviwer.rvrReportViwer.LocalReport.DataSources.Clear();
But it does not work.
推荐答案
这篇关于如何在c#中的一个报表中显示多个rdlc报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!