Basic usage

From DBReport wiki
Jump to: navigation, search

This tutorial is basic use of DBReport. The goal is create two buttons, one for designer and other for print a report.

Requirements

  • DBReport component.
  • A sample SQLite database (sakila database is used for this tutorial, is found in downloaded file).

Walkthrough

  1. Create a project.
  2. Add DBReport component.
  3. Add SQLite database.
  4. Add a button, change caption to "Designer".
  5. Add code for Designer to Action event.
  6. Add a button, change caption to "Print".
  7. Add code for Print to Action event.
  8. Run app.
  9. Click on Designer button.
  10. Add labels and fields to report.
  11. Close designer window.
  12. Click on Print button.

A video show an example here.

Code for Designer button

Dim f As FolderItem= SpecialFolder.Desktop.Child("DBReportTut01.xml")
Dim r As Recordset= sakila.SQLSelect("SELECT * FROM customer")
 
Dim rpt As New DBReport(f, r)
rpt.Designer
rpt.SaveXML(f)

Code for Print button

Dim f As FolderItem= SpecialFolder.Desktop.Child("DBReportTut01.xml")
Dim r As Recordset= sakila.SQLSelect("SELECT * FROM customer")
 
Dim rpt As New DBReport(f, r)
 
rpt.Print