Page 298 - Open Soource Technologies 304.indd
P. 298
Event Driven Programming
Make a table and show the data in data grid view.
13.8.3 Accessing the Data Report
1. Reopen the phone directory project. Add a command button named cmdReport and give
it a Caption of Show Report. (There may be two tabs in your toolbox, one named General
and one named DataReport. Make sure you select from the General tools.)
2. We will now add the data environment and data report files to the project. Click the
Project menu item, then click Add File. Choose denPhone and click OK. Also add
rptPhone. Look at your Project Window. Those files should be listed under Designers.
3. Use this code in cmdReport_Click:
Private Sub cmdReport_Click()
rptPhone.Show
End Sub
4. This uses the Show method to display the data report.
5. Save the application and run it. Click the Show Report button and this should appear:
Figure 13.13: Report.
You now have a printable copy of the phone directory. Just click the Printer icon. Notice the
relationship with this displayed report and the sections available in the Data Report designer.
13.9 Creating a Data Environment Report Using Data Bound Control
Steps to add data report and how to setup its DataSource, DataMember and DataField to display
the record that you like.
292 LOVELY PROFESSIONAL UNIVERSITY