

| Type | Description | |||
| Long | A long expression that indicates the count of items |
The Count property gets the number of items in the collection. Use the ItemByIndex property to retrieve an item by its index. Use the Item property to access an item giving its identifier. Use the ID property to specify the item's identifier. Use the Find property to look for an item. Use the Caption property to specify the caption of the item. Use the VisibleItemsCount property to specify the number of visible items.
The following VB sample enumerates the items in a sub menu:
With ExMenu1(10).SubMenu
Dim i As Long
For i = 0 To .Count - 1
Debug.Print .ItemByIndex(i).Caption
Next
End WithThe following C++ sample enumerates the items in a sub menu:
CMenu1 subMenu = m_menu.GetItem( COleVariant( long(10) ) ).GetSubMenu();
for ( long i = 0; i < subMenu.GetCount(); i++ )
{
CItem item = subMenu.GetItemByIndex( COleVariant( i ) );
OutputDebugString( item.GetCaption() );
}The following VB.NET sample enumerates the items in a sub menu:
With AxExMenu1(10).SubMenu
Dim i As Long
For i = 0 To .Count - 1
Debug.WriteLine(.ItemByIndex(i).Caption())
Next
End WithThe following C# sample enumerates the items in a sub menu:
EXMENULib.Menu subMenu = axExMenu1[10].SubMenu;
for (int i = 0; i < subMenu.Count; i++)
{
EXMENULib.item item = subMenu.get_ItemByIndex(i);
System.Diagnostics.Debug.WriteLine(item.Caption);
}The following VFP sample enumerates the items in a sub menu:
With thisform.ExMenu1.Item(10).SubMenu
local i
For i = 0 To .Count - 1
wait window nowait .ItemByIndex(i).Caption
Next
EndWith