This document is archived and information here might be outdated.  Recommended version.


IToolbarMenu.MoveItem Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > IToolbarMenu Interface > IToolbarMenu.MoveItem Method
ArcGIS Developer Help

IToolbarMenu.MoveItem Method

Moves an item from one index to another.

[Visual Basic .NET]
Public Sub MoveItem ( _
    ByVal startIndex As Integer, _
    [ByVal finalIndex As Integer] _
)
[C#]
public void MoveItem (
    int startIndex,
    int finalIndex
);
[C++]
HRESULT MoveItem(
  long startIndex,
  long finalIndex
);
[C++]
Parameters
startIndex [in]

startIndex is a parameter of type long finalIndex [in, optional, defaultvalue()]
finalIndex is a parameter of type long

Product Availability

Available with ArcGIS Engine.

Description

Moves the item at the specified startIndex, to the position at the specified finalIndex. If no finalIndex is supplied the item is moved to the end of the ToolbarMenu.

Errors Returned

1023 800A03FF: The specified index is out of range

[C#]
//Get a toolbar item
IToolbarItem toolbarItem = axToolbarControl1.GetItem(0);
//Get a the menu from the item  
IToolbarMenu toolbarMenu = toolbarItem.Menu;
if (toolbarMenu == null) return; 
//Move the item
toolbarMenu.MoveItem(0, toolbarMenu.Count - 1);
[Visual Basic .NET]
'Get  a toolbar item
Dim pToolbarItem As IToolbarItem
pToolbarItem = AxToolbarControl1.GetItem(0)
'Get a the menu from the item  
Dim pToolbarMenu As IToolbarMenu
pToolbarMenu = pToolbarItem.Menu
If pToolbarMenu Is Nothing Then Exit Sub
'Move the item
pToolbarMenu.MoveItem(0, pToolbarMenu.Count - 1)

See Also

IToolbarMenu Interface