Page 30 - Open Soource Technologies 304.indd
P. 30

Event Driven Programming



                               In this form, I’ve resized the labels a bit and added a Report Header. Also, make sure you
                               close up the Detail section to a single line. Any space left in this section will be inserted
                               after each entry.
                            6. Click File and Save rptPhone As. Save the environment in an appropriate folder. We will
                               now reopen our phone database manager and attach this and the data environment to that
                               project and add capabilities to display the report.
                          2.1.4 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 2.16:  Data Report Accessing.
                          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.




                          24                     LOVELY PROFESSIONAL UNIVERSITY
   25   26   27   28   29   30   31   32   33   34   35