Loads a layer file and adds it to the Map's collection of layers at the specified index position.
[Visual Basic 6.0] Sub AddLayerFromFile(
ByVal lyrPath As String, _
[ByVal toIndex As Long] _
) As Empty
[Visual Basic .NET] Public Sub AddLayerFromFile ( ByVal lyrPath As String, _ ByVal toIndex As Integer _ )
When a layer file is added to the MapControl's layer collection and no index is specified, it is added to the beginning or top of the collection with an index of 0. The numeric index of any other layers in the layer collection increments by one.
When a layer file is added and an index is specified, the numeric index of any other layers in the layer collection will increment by one, except for those layers with an index less than the specified index. The index of these layers will remain the same.
MapControl1.AddLayerFromFile "C:\Temp\myLayer.lyr", 2
MapControl1.Layer (0) 'Last layer to draw MapControl1.Layer (1) 'Second from last layer to draw MapControl1.Layer (MapControl1.LayerCount - 1 ) 'First layer to draw