Copy Method for LCField

This method creates a field with the settings and values of a source field. The new field contains the same number of data values of the same data type as the source field. The new values are copies of, rather than references to, the original data.

Defined In

LCField

Syntax

Set newField = origField.Copy

Parameters

Parameter

Description

origField

LCField. The field object that you want to copy

Return Value

Value

Description

newField

LCField. The copy of the original field.

Usage Notes®

You must explicitly use the copy method. If instead, you use the statement:

Set newField = origField

you have not copied the value of the field -- you have merely created another "pointer" to the same LCField object. If you then change the value stored in newField, the value in origField will also change (and vice versa) because they are in reality the same field.

Example

Option Public
Uselsx "*lsxlc"  
Sub Initialize
  Dim field As New LCField (LCTYPE_FLOAT)
  Dim c_field As LCField
  field.value = 12345.123456789
  Set c_field = field.Copy
  Print "The float field is " & field.text(0)
  Print "and its copy is " & c_field.text(0)
End Sub

Example Output

The float field is 12345.123456789 and its copy is 12345.123456789.