Extracted WinForm Control development 5, WinForm development: RDLCCustomAssemblyAccessFS, report development, custom report, custom Initialization

Source: Internet
Author: User
1. Report design: for common rdlc reports, you must add database data sources. In this case, the database must be bound. Here, the report and database are separated. Initialize the report in the form and assign values to the report. 2. Report design: Create a report Report1.rdlc, add a data source, select an object, and select Person at the Mode layer.

 

3. Set the report data source, design the report interface, drag the table, and assign the field of the Person object to the table. Then set the report data source

Menu: Report/data source,

 

Modify the data source name of the report to myds.

Set the data source name of the table in the report: myds

 

4. Load the report and drag the ReportView in the Form Designer.

Select the report you just added, and then delete the "* DataSource" automatically added to the page"

5. The code for initializing the report is as follows:

Code List <Person> listPerson = new List <Person> ();
Person per = new Person ("123", 25 );
ListPerson. Add (per );
DataSet orderSet = new DataSet ();
OrderSet = DataSetHelper. ToDataSet <Person> (listPerson as IList <Person> );
This. reportViewer. LocalReport. CES. Clear ();
// This. reportViewer. LocalReport. CES. Add (new Microsoft. Reporting. WinForms. ReportDataSource ("myds", DataSetHelper. ToDataTable (listPerson as IList <Person> )));
This. reportViewer. LocalReport. CES. Add (new Microsoft. Reporting. WinForms. ReportDataSource ("myds", listPerson. ToArray <Person> ()));
This. reportViewer. RefreshReport ();

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.