Adding Run-time Designer to your Project

  1. Click on the run-time designer icon in the toolbox.
  2. Place the control on the form (shown below) and size it accordingly.

The run-time designer's appearance is the same as the ActiveReports ActiveX designer but the end user will not have direct access to the reporting events in Visual Basic. Instead, the user will use VBScript or JScript to handle the reporting events as needed. The run-time designer includes a syntax-highlighting editor for both languages.

The following sample demonstrates adding the run-time designer to a Visual Basic project and using ActiveReport's viewer control to view reports designed at run time.

  1. Start a new Visual Basic standard EXE project.
  2. Select the following components from Visual Basic's components list:
    • Data Dynamics ActiveReports Runtime Designer
    • Data Dynamics ActiveReports Viewer 2.0
    • Microsoft Tabbed Dialog Control
  3. Add the following references from Visual Basic's reference list:
    • Data Dynamics ActiveReports 2.0
  4. Select Form1 and set its properties as follows:

    Name

    frmMain

    Caption

    Simple Designer Project

    Height

    9465

    Width

    11295

 

  1. Add a SSTab control to frmMain and set its properties as follows:

    Height

    9015

    Left

    0

    Tabs

    2

    Top

    0

    Width

    11175

  2. Right-click on SSTab1 and select properties.
  3. Set the TabCaption for Tab0 to Run-time Designer.
  4. Set the TabCaption for Tab1 to Report Preview and select OK to close the tab control's property page.
  5. Add the run-time designer to Tab0 and set its properties as follows:

    Name

    ard

    Height

    8415

    Left

    120

    Top

    480

    Width

    10935

  1. Add the viewer control to Tab1 and set its properties as follows:

    Name

    arv

    Height

    8535

    Left

    120

    Top

    360

    Width

    10935

  2. frmMain should look like this:

  3. Add the following code to the Form_Load event:

    Dim rpt As DDActiveReports2.ActiveReport
     
    Private Sub Form_Load()
    'Set active Tab to the designer
    SSTab1.Tab = 0
    Set rpt = New ActiveReport
    'Activate all the toolbars
    ard.ToolbarsVisible = ddTBToolBox + ddTBAlignment + ddTBExplorer + _
    ddTBFields + ddTBFormat + ddTBMenu + ddTBPropertyToolbox + ddTBStandard
     
    ard.ToolbarsAccessible = ddTBToolBox + ddTBAlignment + ddTBExplorer + _
    ddTBFields + ddTBFormat + ddTBMenu + ddTBPropertyToolbox + ddTBStandard
    End Sub

    Note: When working with the designer, the toolbars cannot be customizing. The only available options are ToolbarsVisible and ToolbarsAccessible. If the project requires custom toolbars, a third party toolbar control will need to be substituted for the runtime designer's toolbars.

  4. Add the following code to the SSTab1_Click event:

    Private Sub SSTab1_Click(PreviousTab As Integer)
    Select Case PreviousTab
    Case Is = 0
    prepPreview
    Case Is = 1
    prepDesigner
    End Select
     
    End Sub

  5. Add the following code to prepare the viewer control and designer when its tab is selected:

    Private Sub prepPreview()
    On Error GoTo errHndl
    'Must be used to writes the designer's layout
    'to the report so it can be previewed
    ard.SaveToObject rpt
    rpt.Restart
    'Run the new report
    rpt.Run False
    'Add the report to the veiwer
    Set arv.ReportSource = rpt
    Exit Sub
     
    errHndl:
    MsgBox "Error Previewing the Report: " & Err.Number & " " & Err.Description
    End Sub
     
    Private Sub prepDesigner()
    On Error GoTo errHndl
     
    If Not arv.ReportSource Is Nothing Then
    arv.ReportSource.Cancel
    Set arv.ReportSource = Nothing
    End If
     
    Exit Sub
    errHndl:
    MsgBox "Error in Design Preview: " & Err.Number & " " & Err.Description
    End Sub

    Note: SaveToObject must be used to save the changes made in the run-time designer to an ActiveReport report object. You should always use that object to run and preview the report, do NOT use the designer's Report property to run and preview the report.

  6. Save and run the project.
  7. While the project is running, continue on to the next sample for a demonstration on using the designer at run time.

Working with the Designer at Run time