报告查看器未加载 [英] Report Viewer not loading

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

问题描述

您好

我有一个Windows窗体应用程序,其中用户在特定表单(A)上输入值,并且相同的值将用于生成另一种形式的报表(B )。报告的数据集未加载,因为它需要表单A中文本框的值。请问,我该怎么做?它给了我一个错误没有重载方法填充需要1个参数请帮助

这个代码

Hello
I have a windows form application where a user inputs a value on a particular form (A) and that same value is to be used to generate a report which is on another form (B). The dataset for the report is not loading because it needs the value of the textbox in form A. Please, how can I do this? It's giving me an error of "No overload for method Fill takes 1 arguments" please help
this the code

public string entmatno
       {
           get { return entmatno.Text; }
       }
private void Resultpage_Load(object sender, EventArgs e)
        {

            // TODO: This line of code loads data into theCourseInfoDataSet.COURSEINFO_TBL; table. You can move, or remove it, as needed.
            this.COURSEINFO_TBLTableAdapter.Fill(this.CourseInfoDataSet.COURSEINFO_TBL, entmatno.text);

            this.reportViewer1.RefreshReport();
        }

请注意表单是通过单击A

Please note the form is fired by a button click in form A

推荐答案

中的按钮触发的。您无法在表单A上引用文本框表单B的代码内部。表单B无法访问该控件。



您需要将表单A上的文本框中的值传递给表单B.有很多方法可以做到这一点。



查看关于codeproject的这篇文章

在表格之间传递数据 [ ^ ]
You cannot reference a textbox on form A inside the code for form B. form B has no way to access that control.

You need to pass the value in the textbox on form A to form B. There are a number of ways to do that.

Check out this article on codeproject
Passing Data Between Forms[^]


你需要将表单1上的文本框的值传递给表单2,这样就可以了2可以用它来获取数据集。



我认为你需要做这样的事情(使用我建议的文章中的构造方法)

http://www.codeproject.com/Articles/14122/Passing Grant-表格之间





You need to pass the value of the text box on form 1 to form 2 so form 2 can use it to get the dataset.

I think you need to do something like this (using the "constructor approach" from the article i suggested)
http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms


//in form1:

private void button1_Click(object sender, System.EventArgs e)
{
    //open form 2 and pass it the value of the textbox on form 1
    Form2 frm=new Form2(entmatno.Text);
    frm.Show();
}


//in Form2:
String entmatno = "";

public string Entmatno
       {
           set { entmatno = value; }
           get { return entmatno; }
       }


public Form2(string entmatnoFromForm1)
{
  InitializeComponent();
  Entmatno=entmatnoFromForm1);
}

private void Resultpage_Load(object sender, EventArgs e)
        {

            // TODO: This line of code loads data into theCourseInfoDataSet.COURSEINFO_TBL; table. You can move, or remove it, as needed.
            this.COURSEINFO_TBLTableAdapter.Fill(this.CourseInfoDataSet.COURSEINFO_TBL, Entmatno);

            this.reportViewer1.RefreshReport();
        }


这篇关于报告查看器未加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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