TX Text Control ActiveX

RemoveChild Method

Method

Removes a sub-element from this element. If this element has more than one sub-element of the type with the given name, the optional Index parameter can be used to specify the sub-element to remove. If Index is omitted Text Control removes the first sub-element with the given name.

Syntax

XMLElement.RemoveChild ElementName[, Index]

Parameters

ParameterDescription
ElementNameSpecifies the name of the sub-element to remove.
IndexOptional. Specifies the number of the subelement. If this value does not match any existing sub-element, an error occurs.

Return Value

The method returns one of the following values:

ValueDescription
0An error has occurred.
1The element could not be removed because the document becomes invalid according to the document's DTD. In this case Text Control fires an XMLInvalid event.
2The sub-element has successfully been removed.

Examples

The following Basic example removes the second "Telephone" element of the second address in an XML document that contains addresses consisting of the sub-elements Name, Street, City and Telephone:

TXTextControl1.XMLElements("Address")(2).RemoveChild "Telephone", 2

See Also