property Items.ItemChild (Item as HITEM) as HITEM

Retrieves the first child item of a specified item.

TypeDescription
Item as HITEM A long expression that indicates the item's handle.
HITEM A long expression that indicates the handle of  the first child item.

If the ItemChild property gets 0, the item has no child items. Use the ItemChild property to get the first child of an item. The NextVisibleItem or NextSiblingItem gets the next visible, sibling item. Use the InsertItem method to insert a child item. Use the ItemParent property to retrieve the handle of the parent item. The control displays a +/- sign to parent items, if the HasButtons property is not zero, the ItemChild property is not empty, or the ItemHasChildren property is True.

The following VB function recursively enumerates the item and all its child items:

Sub RecItem(ByVal c As EXCOMBOBOXLibCtl.ComboBox, ByVal h As HITEM)
    If Not (h = 0) Then
        Dim hChild As HITEM
        With c.Items
            Debug.Print .CellCaption(h, 0)
            hChild = .ItemChild(h)
            While Not (hChild = 0)
                RecItem c, hChild
                hChild = .NextSiblingItem(hChild)
            Wend
        End With
    End If
End Sub

The following C++ function recursively enumerates the item and all its child items:

void RecItem( CComboBox* pComboBox, long hItem )
{
	COleVariant vtColumn( (long)0 );
	if ( hItem )
	{
		CItems items = pComboBox->GetItems();

		CString strCaption = V2S( &items.GetCellCaption( COleVariant( hItem ), vtColumn ) ), strOutput;
		strOutput.Format( "Cell: '%s'\n", strCaption );
		OutputDebugString( strOutput );

		long hChild = items.GetItemChild( hItem );
		while ( hChild )
		{
			RecItem( pComboBox, hChild );
			hChild = items.GetNextSiblingItem( hChild );
		}
	}
}

The following VB.NET function recursively enumerates the item and all its child items:

Shared Sub RecItem(ByVal c As AxEXCOMBOBOXLib.AxComboBox, ByVal h As Integer)
    If Not (h = 0) Then
        Dim hChild As Integer
        With c.Items
            Debug.WriteLine(.CellCaption(h, 0))
            hChild = .ItemChild(h)
            While Not (hChild = 0)
                RecItem(c, hChild)
                hChild = .NextSiblingItem(hChild)
            End While
        End With
    End If
End Sub

The following C# function recursively enumerates the item and all its child items:

internal void RecItem(AxEXCOMBOBOXLib.AxComboBox  combobox, int hItem)
{
	if (hItem != 0)
	{
		EXCOMBOBOXLib.Items items = combobox.Items;
		object caption = items.get_CellCaption( hItem, 0 );
		System.Diagnostics.Debug.WriteLine(caption != null ? caption.ToString() : "");

		int hChild = items.get_ItemChild(hItem);
		while (hChild != 0)
		{
			RecItem(combobox, hChild);
			hChild = items.get_NextSiblingItem(hChild);
		}
	}
}

The following VFP function recursively enumerates the item and all its child items ( recitem method ):

LPARAMETERS h

with thisform.ComboBox1
    If ( h != 0 ) Then
        local hChild
        With .Items
        	.DefaultItem = h
            wait window .CellCaption(0, 0)
            hChild = .ItemChild(h)
            do While (hChild != 0)
                thisform.recitem(hChild)
                hChild = .NextSiblingItem(hChild)
            enddo
        EndWith
    EndIf
endwith