ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Working with C1Report > Working with VBScript

Working with VBScript

VBScript expressions are widely used throughout a report definition to retrieve, calculate, display, group, sort, filter, parameterize, and format the contents of a report. Some expressions are created for you automatically (for example, when you drag a field from the Toolbox onto a section of your report, an expression that retrieves the value of that field is displayed in the text box). However, in most cases, you create your own expressions to provide more functionality to your report.

Note the following differences between VBScript expressions and statements:

      Expressions return values, you can assign them to things like Field.Text, for example:

Field1.Calculated = true
Field1.Text = "iif( 1=1, 1+2, 1+3 )"

      Statements don't return values. You can assign them to event properties like OnFormat. For example:

c1r.OnOpen = "if 1=1 then msgbox("OK!!!") else msgbox("ooops")"

C1Report relies on VBScript to evaluate expressions in calculated fields and to handle report events.

VBScript is a full-featured language, and you have access to all its methods and functions when writing C1Report expressions. For the intrinsic features of the VBScript language, refer to the Microsoft Developer's Network (MSDN).

C1Report extends VBScript by exposing additional objects, variables, and functions. These extensions are described in the following sections.


VBScript Elements, Objects, and Variables

Using Compatibility Functions: Iif and Format

Using Aggregate Functions


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.