# XmlElement.GetChildItem Method

> Returns an XML Element object that represents a child element of this element.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > XmlElement.GetChildItem Method
- **841 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/getchilditem-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/getchilditem-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/getchilditem-method/llms-full.txt

---

### Description

Returns an XML Element object that represents a child element of this element.

### Syntax

#### GetChildItem(string)

Returns the first XML child element with the specified name.

```csharp
public XmlElement GetChildItem(string name);
```

```vbnet
Public Function GetChildItem(name As String) As XmlElement
```

| Parameter | Description |
|---|---|
| name | Specifies the name of the sub-element. |

#### GetChildItem(string, int)

Returns the XML child element with the specified name and index.

```csharp
public XmlElement GetChildItem(string name, int index);
```

```vbnet
Public Function GetChildItem(name As String, index As Integer) As XmlElement
```

| Parameter | Description |
|---|---|
| name | Specifies the name of the sub-element. |
| index | Specifies the number of the sub-element beginning with 1. If this value does not match any existing sub-element, an error occurs. |

### Return Value

The return value is a valid XmlElement object.

### Examples

The following example gets the Telephone element from the second address in an XML document that contains adresses consisting of the sub-elements Name, Street, City and Telephone:

```csharp
XmlElement element = textControl1.GetXmlElements("Adress").GetItem(2).GetChildItem("Telephone");
```

```vbnet
Dim Element As XmlElement = TextControl1.GetXmlElements("Adress").GetItem(2).GetChildItem("Telephone")
```

The following example retrieves child item from the xml element.

```csharp
XmlElement result = xmlElement.GetChildItem("CustomerName", 1);
result?.Select();
```

```vbnet
Dim result As XmlElement = xmlElement.GetChildItem("CustomerName", 1)
If result IsNot Nothing Then result.Select()
```

---

## Nearby

- **Previous:** [XmlElement.ElementName Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/elementname-property/llms-full.txt)
- **Next:** [XmlElement.RemoveChild Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/removechild-method/llms-full.txt)
