如何在cbo中提供.rdlc(报告)列表以填充查看器? [英] How do I supply a list of .rdlc(reports) in a cbo to populate a viewer?

查看:73
本文介绍了如何在cbo中提供.rdlc(报告)列表以填充查看器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家早上好!



我有一个问题,我想要一些帮助。我正在构建一个Winforms桌面应用程序(c#),我正在尝试使用我构建的一些报告(在VS内部)填充组合框。在我的表单上,我有三个控件,一个组合框cboReports,一个按钮btnViewReport和一个报表查看器reportViewer。我试图用我创建的报告填充cboReports。选择报告后,用户将单击btnViewReport,所选报告将填充reportViewer报告视图。



Good morning all!

I've got a problem that I'd like some help with. I am building a Winforms desktop application (c#) and I'm trying to populate a combobox with some reports I've built (inside of VS). On my form I have three controls, one combobox cboReports, one button btnViewReport and one report viewer reportViewer. I am trying to populate the cboReports with reports I've created. Upon selecting a report the user will click btnViewReport and the selected report will fill reportViewer report view.

this.reportViewer.RefreshReport();
    }

    private class Data
    {
        public string Name { get; set; }
        public string RptValue { get; set; }
    }



    public string strReport { get; set; }

    private void cboReports_SelectedIndexChanged(object sender, EventArgs e)
    {

        BindingList<Data> _comboItems = new BindingList<Data>();
        _comboItems.Add(new Data { Name = "Select", RptValue = "Select a report" });
        _comboItems.Add(new Data { Name = "CJ01_DateRange", RptValue = "CJ01_DateRange.rdlc" });

        cboReports.DataSource = _comboItems;
        cboReports.DisplayMember = "Name";
        cboReports.ValueMember = "RptValue";

        strReport = "ReportViewer." + cboReports.SelectedValue;

    }





这是我到目前为止所拥有的。有人可以帮忙吗?



This is what I have so far. Can someone help please?

推荐答案

根据评论,看来你真的在寻找如何做到这一点的大方向。



基本上你只需要将你的报告列表添加到你的组合框中,然后手动完成。



当所选索引发生变化时只需将报表查看器使用的rdl更改为他们更改的版本。
Based on the comments, it appears you are really looking for general direction on how to do this.

Essentially you just need to add your list of reports to your combobox, and just do that manually.

Then when the selected index changes just change the rdl that your report viewer is using to be the one they changed.


这篇关于如何在cbo中提供.rdlc(报告)列表以填充查看器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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