Page 292 - Open Soource Technologies 304.indd
P. 292
Event Driven Programming
Two items should appear: a text box Name and a text box Name (PhoneList). The first
text box is heading information. Move this text box into the Page Header section. The
second text box is the actual value for Name from the PhoneList table. Line this text box
up under the Name header. Now, drag the Phone tab from the Data Environment to the
Data Report. Adjust the text boxes in the same manner. Our data report will have page
headers Name and Phone. Under these headers, these fields for each record in our
database will be displayed. When done, the form should look something like this:
Figure 13.4: Data Report.
In this form, we have 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.
13.8.2 Adding Data Report
Step 1: Start Visual Basic as a Standard EXE project. From the Project menu in the VBE, select
Add Data Report in the dropdown menu. Now, you will be presented with the data report
environment, as shown in Figure 13.5. The data report environment contains 6 controls, they are
RptTextBox, RptLine, RptFunction, RptLabel, RptImage and RptShape.
You can customize your report here by adding a title to the page header using the report label
RptLabel. Simply drag and draw the RptLabel control on the data report designer window and
use the Caption property to change the text that should be displayed. You can also add graphics
to the report using the RptImage control.
286 LOVELY PROFESSIONAL UNIVERSITY