Using the Report component in Visual Studio (WinForms)
Let us consider the typical use of the Report component in Visual Studio. We will use the data from a typed dataset.
- create a new Windows Forms application;
- add a dataset into it ("Data|Add New Data Source..." menu item);
- switch to the Form designer;
- add the "DataSet" component on a form and connect it to the typed dataset that you have created.
To create a report, perform the following steps:
- put the "Report" component on a form:
- right-click it (or click on a smart tag button) and select the "Design Report..." item:
- choose the data source to use in a report:
- create your report. Read more about this in the User's Manual;
- close the report designer;
- add a "Button" control on your form;
- double-click it and write the following code in the
button_Click
event handler:
report1.Show();
- save the project and run it. When you click on a button you will see the prepared report.