如何在新窗口中传递参数以加载水晶报告 [英] How can I pass the parameters to load crystal report in a new window

查看:52
本文介绍了如何在新窗口中传递参数以加载水晶报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用c#.net开发一个Windows窗体应用程序,在我的应用程序中,我想使用form1中的日期时间选择器输入开始日期和结束日期,并且需要在所选日期之间打开包含数据的水晶报表form2作为一个新窗口我已经设计了水晶报告,报告工作正常。然后设计form2与水晶报表查看器来查看报告。但我不知道如何将form1中的日期(参数)传递给包含水晶报表查看器的form2。请有人可以帮我这样做。



尝试使用以下代码,但没有任何反复



我尝试了什么:



myDataSet ds = new myDataSet();

frm_ReportViewer viewForm = new frm_ReportViewer();

viewForm.Owner = this;



rpt_myreport report = new rpt_myreport();

report.Load(Reports \\rpt_myreport。 rpt);



report.SetDataSource(ds);

viewForm.crv_common.ReportSource = report;

viewForm.ShowDialog(this);

Hi, I'm developing a windows forms application using c#.net, in my application i want to enter start date and end date using a date time picker in form1 and need to open a crystal report with data between selected dates on form2 as a new window I've already designed crystal report and the report works fine. then designed form2 with crystal report viewer to view the report. but i don't know how to pass dates (parameters) from form1, to form2 which contain crystal report viewer. please someone can help me to do this.

Tried with following code, but nothing happened

What I have tried:

myDataSet ds = new myDataSet();
frm_ReportViewer viewForm = new frm_ReportViewer();
viewForm.Owner = this;

rpt_myreport report = new rpt_myreport();
report.Load("Reports\\rpt_myreport.rpt");

report.SetDataSource(ds);
viewForm.crv_common.ReportSource = report;
viewForm.ShowDialog(this);

推荐答案

@OriginalGriff撰写了一系列关于如何在表单之间传递信息的技巧。第一个是在两个表格之间传递信息,第1部分:父母对孩子 [ ^ ] - 其他链接出现在该文章中
@OriginalGriff has written a series of Tips on how to pass information between forms. The first one is here Transferring information between two forms, Part 1: Parent to Child[^] - links to the others appear in that article


这篇关于如何在新窗口中传递参数以加载水晶报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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