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.

  1. Start by running the sample project created above.
  2. Place an ADO data control in the designer's detail section.
  3. 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.

  4. Set the DataControl's source property to the following SQL statement:

    SELECT * FROM customers order by country

  5. Right-click on the designer and select insert to add a new GroupHeader/Footer.
  6. Click on the new section “GroupHeader1” to select it.
  7. Modify the section's properties as follows:
    Name ghOrderGroup
    DataField Country
    Height 750
  8. Click on the new section “GroupFooter1” to select it.
  9. Modify the section's properties as follows:
    Name gfOrderGroup
    Height 270
  10. 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
  11. 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
  12. Click and drag the following fields from the fields list into the detail section: CompanyName, City, Country and PostalCode.
  13. 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
  14. Set the detail sections height to 285.
  15. The designer should look like this:

  16. Click on the Report Preview tab to run and show the report.

  17. Switch back to the Runtime Designer tab and follow the next sample to see how the designer's layout can be saved.