This document is archived and information here might be outdated. Recommended version. |
Returns the item at the specified index from the ToolbarControl.
[Visual Basic .NET] Public Function GetItem ( _ ByVal index As Integer _ ) As IToolbarItem
[C#] public IToolbarItem GetItem ( int index );
[C++]
HRESULT GetItem(
long index
);
[C++]
Parameters index [in]
index is a parameter of type long
The property is used to access a particular item on the ToolbarControl. The item at the beginning of the collection to the left of the ToolbarControl has an index of 0. Visually items are represented on the ToolbarControl as buttons, tools, menus, text boxes and combo boxes.
1023 800a03ff: The specified index is out of range
To loop through a ToolBarControl's item collection use the GetItem property in conjunction with the Count property.
IToolbarItem toolbarItem=axToolbarControl1.GetItem(0);
toolbarItem=axToolbarControl1.GetItem(1);
toolbarItem=axToolbarControl1.GetItem(axToolbarControl1.Count - 1); //Last Item
//Loop through each item on the ToolbarControl
for (int i=0;i<=axToolbarControl1.Count - 1;i++)
{
IToolbarItem toolbarItem=axToolbarControl1.GetItem(0);
}
Dim pToolbarItem As IToolbarItem
pToolbarItem=AxToolbarControl1.GetItem(0) 'First Item
pToolbarItem=AxToolbarControl1.GetItem(1) 'Second Item
pToolbarItem=AxToolbarControl1.GetItem(AxToolbarControl1.Count - 1) 'Last Item
'Loop through each item on the ToolbarControl
Dim i As Long
For i=0 To AxToolbarControl1.Count - 1
pToolbarItem=AxToolbarControl1.GetItem(i)
'Do something...
Next i