如何使用2个不同的按钮在单个reportviewer中使用多个报告? [英] how to use multiple reports in single reportviewer using 2 different buttons?
本文介绍了如何使用2个不同的按钮在单个reportviewer中使用多个报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用c#
推荐答案
在asp.net中使用2个不同的按钮在单个reportviewer中使用多个报告,只需将这段代码放在按钮单击事件中即可.
按钮1和报告1
Just put this code inside button click event....
for button 1 and report 1
ReportDocument rpt = new ReportDocument();
rpt.Load("REPORT1.rpt");
CRPTViewer.ReportSource = rpt;
CRPTViewer.RefreshReport();
用于按钮2和报告2
for button 2 and report 2
ReportDocument rpt = new ReportDocument();
rpt.Load("REPORT2.rpt");
CRPTViewer.ReportSource = rpt;
CRPTViewer.RefreshReport();
按钮
{
字符串txt =销售金额帐单明细";
Crystalreport obj =新的Crystalreport();
obj.Show();
}
在cs
加载
{
如果(txt ==销售金额帐单明细")
SalesAmountBillDetails();
}
SalesAmountBillDetails()
{
试试
{
CRNewSalesBillDetails5 objcr =新的CRNewSalesBillDetails5();
objLib.SetReportConnection(objcr);
crystalReportViewer1.ReportSource = objcr;
this.Text =销售金额帐单明细";
}
捕获(异常ErrMessage)
{
MessageBox.Show(ErrMessage.Message,"kalai",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
button
{
string txt = "Sales Amount BillDetails";
Crystalreport obj = new Crystalreport();
obj.Show();
}
in cs
load
{
if (txt == "Sales Amount BillDetails")
SalesAmountBillDetails();
}
SalesAmountBillDetails()
{
try
{
CRNewSalesBillDetails5 objcr = new CRNewSalesBillDetails5();
objLib.SetReportConnection(objcr);
crystalReportViewer1.ReportSource = objcr;
this.Text = "Sales Amount Bill Details";
}
catch (Exception ErrMessage)
{
MessageBox.Show(ErrMessage.Message, "kalai", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
这篇关于如何使用2个不同的按钮在单个reportviewer中使用多个报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文