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.
Name | frmMain |
Caption | Simple Designer Project |
Height | 9465 |
Width | 11295 |
Height |
9015 |
Left |
0 |
Tabs |
2 |
Top |
0 |
Width |
11175 |
Name | ard |
Height | 8415 |
Left | 120 |
Top | 480 |
Width | 10935 |
Name |
arv |
Height |
8535 |
Left |
120 |
Top |
360 |
Width |
10935 |
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.
Private Sub SSTab1_Click(PreviousTab As Integer)
Select Case PreviousTab
Case Is = 0
prepPreview
Case Is = 1
prepDesigner
End Select
End Sub
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.
See Also |