Working with the Designer at Run time
This sample demonstrates the fundamentals of using the designer at run time. The
simple report created in this sample will be used to demonstrate more advanced features
later on in the manual. At runtime the designer functions similarly to the ActiveX
designer but does not allow access to the report events or code.
- Start by running the sample project created above.
- Place an ADO data control in the designer's detail section.
- Connect to Nwind.mdb (see chapter 3 in the standard edition user's guide).
Note: The samples in this manual use the NorthWind database
included with Microsoft Visual Basic.
- Set the DataControl's source property to the following SQL statement:
SELECT * FROM customers order by country
- Right-click on the designer and select insert to add a new GroupHeader/Footer.
- Click on the new section “GroupHeader1” to select it.
- Modify the section's properties as follows:
Name
|
ghOrderGroup
|
DataField
|
Country
|
Height
|
750
|
- Click on the new section “GroupFooter1” to select it.
- Modify the section's properties as follows:
Name
|
gfOrderGroup
|
Height
|
270
|
- Add a Field control to the ghOrderGroup section and set its properties as
follows:
Name
|
txtGroupCountry
|
DataField
|
Country
|
Height
|
360
|
Left
|
0
|
Top
|
0
|
Width
|
4230
|
Font .Size
|
12
|
Font .Bold
|
True
|
- Place 4 labels in the ghOrderGroup section and set their properties as follows:
Name
|
lblCustomer
|
lblCity
|
lblCountry
|
lblPostalCode
|
Caption
|
Customer
|
City
|
Country
|
PostalCode
|
Height
|
270
|
270
|
270
|
270
|
Left
|
0
|
2970
|
5490
|
7380
|
Top
|
450
|
450
|
450
|
450
|
Width
|
2880
|
2430
|
1800
|
1800
|
- Click and drag the following fields from the fields list into the detail section:
CompanyName, City, Country and PostalCode.
- Set the field's properties as follows:
Name
|
txtCustomer
|
txtCity
|
txtCountry
|
txtPostalCode
|
DataField
|
CompanyName
|
City
|
Country
|
PostalCode
|
Height
|
270
|
270
|
270
|
270
|
Left
|
0
|
2970
|
5490
|
7380
|
Top
|
0
|
0
|
0
|
0
|
Width
|
2880
|
2430
|
1800
|
1800
|
Alignment
|
0-Left
|
0-Left
|
0-Left
|
1-Right
|
- Set the detail sections height to 285.
- The designer should look like this:
- Click on the Report Preview tab to run and show the report.
- Switch back to the Runtime Designer tab and follow the next sample to see how the designer's layout can be saved.