如何在c#中的一个报表中显示多个rdlc报告 [英] How do i show multiple rdlc report in one report veiwer in c#

查看:378
本文介绍了如何在c#中的一个报表中显示多个rdlc报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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.

推荐答案

在主报告中使用子报告。这是显示多个报告的方式。
use sub reports in main report.this is the way to show multiple report.


我已经解决了。这是一个设置公共形式修饰符的问题。

非常感谢。
I have solved it. It was an issue of form modifier to set public.
Thank you very much.


这篇关于如何在c#中的一个报表中显示多个rdlc报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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