GetChild method

The GetChild method gets a referenced child object by using the index of the child object. You can use this method to retrieve a field on a page when you know the position, but not the name.

Syntax

VBScript
oDCO GetChild (nIndex as Long ) as Object
C#
TDCOLib.DCO GetChild(int nIndex)

Arguments

nIndex
The index of the child, where 0 is the first child

Returns

Returns the child object if successful; returns nothing otherwise.

Applies to

All objects.

VBScript example

This example gets the name of the first four fields on a page, and displays each name in a message box.
Dim objViewField(4)
Dim I
i = 0
Do While i < 4
  Set objViewField(i) = oDCO.GetChild(i)
  msgbox objViewField(i).Text
  i = i + 1
Loop

C# example

This example returns the first field object on the page:
m_oDCOField = m_oDCOPage.FindChild(0);
  • You can retrieve a child object by ID instead of by index by using the FindChild method.
  • You can create a loop by using the GetChild method with the NumOfChildren method to get all of the child objects that are associated with an object.