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

IMapControl2.MoveLayerTo Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IM > IMapControl2 Interface > IMapControl2.MoveLayerTo Method
ArcGIS Developer Help

IMapControl2.MoveLayerTo Method

Moves a layer within the Map's collection from its current index position to a new index position.

[Visual Basic .NET]
Public Sub MoveLayerTo ( _
    ByVal fromIndex As Integer, _
    ByVal toIndex As Integer _
public void MoveLayerTo (
    int fromIndex,
    int toIndex
HRESULT MoveLayerTo(
  long fromIndex,
  long toIndex
fromIndex [in]

fromIndex is a parameter of type long toIndex [in]
toIndex is a parameter of type long

Product Availability

Available with ArcGIS Engine.


The Layer at the beginning or top of the collection with an index of 0 will be drawn last, whilst the Layer at the bottom of the collection will be drawn first.

Errors Returned

1023 800a03ff: The specified index is out of range

See Also

IMapControl2 Interface | IMapControl4.ClearLayers Method | IMapControl2.ClearLayers Method | IMapControl3.ClearLayers Method | IMapControl4.DeleteLayer Method | IMapControl2.DeleteLayer Method | IMapControl3.DeleteLayer Method | IMapControl4.Layer Property | IMapControl3.Layer Property | IMapControl2.Layer Property | IMapControl4.LayerCount Property | IMapControl3.LayerCount Property | IMapControl2.LayerCount Property