Copy Method for LCFieldlist
This method creates a duplicate copy of an LCFieldlist and all its data. Every field in the LCFieldlist is also duplicated, so you don't end up with two fieldlists that both refer to the same LCField objects.
If you want to have two fieldlists that reference the same LCField objects, use CopyRef instead.
Defined In
LCFieldlist
Syntax
Set fldListRecordNew = fldListRecord. Copy
Parameters
Parameter |
Description |
---|---|
fldListRecord |
LCFieldlist. The fieldlist that you want to copy. |
Return Value
Value |
Description |
---|---|
fldListRecordNew |
LCFieldlist. The copy of the fldListRecordobject. |
Example
Option Public
Option Explicit
Uselsx "*lsxlc"
Sub Initialize
Dim olist As New LCFieldlist
Dim nlist As LCFieldlist
Dim ofield As LCField, nfield As Lcfield
Set ofield = olist.Append ("FirstName", LCTYPE_TEXT)
ofield.Text = "Chi Len"
Set nlist = olist.Copy
Set nfield = nlist.GetField (1)
Print "before update, original=" & ofield.Text(0) & ", copy=" & nfield.Text(0)
nfield.Text = "Cheiko"
Print "after update, original=" & ofield.Text(0) & ", copy=" & nfield.Text(0)
Call nlist.Setname(1, "FullName")
Print "The copy contains field named " & nlist.Names(0) _
& " whose value is " & nfield.Text(0)
End Sub
Example Output
before update, original=Chi Len, copy=Chi Len
after update, original=Chi Len, copy=Cheiko
The copy contains field named FullName whose value is Cheiko