ComponentOne VSView Reporting Edition
Add Method (FieldCollection)

Adds a Field to a Fields collection.

Syntax

fields.Add Name As String, Text As String, Left As Double, Top As Double, Width As Double, Height As Double

Remarks

The parameters for the Add method are described below:

Name As String

This parameter contains the name of the new field. You should try to use a consistent naming scheme and avoid using duplicate names for report fields and database fields. Using repeated names may cause your VBScript expressions to yield unexpected results.

Text As String

This parameter contains the value for the new field's Text property. This value may be treated as a literal or as a VBScript expression, depending on the setting of the field's Calculated property. By default, Calculated is set to False and the text is rendered as-is.

Left, Top, Width, Height As Double

These parameters define the position of the field with respect to its containing section.

NOTE: If you add a field to a section's Fields collection, the new field is automatically assigned to that section. If you add a field to the control's Fields collection, the new field is not assigned to any sections. In this case, you must set the field's Section property or it will not be rendered in the report.

For example:

vsr.Fields.Add "NewField", "Hello World", 100, 100, 2000, 300

vsr.Fields("NewField").Section = vsrDetail

The Add method returns a reference to the newly added field, so the above code could also be written as:

Dim theField As Field

Set theField = vsr.Fields.Add("NewField", "Hello World", 100, 100, 2000, 300)

theField.Section = vsrDetail

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback