<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Set Layer Index for Added Layer in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/set-layer-index-for-added-layer/m-p/158018#M4152</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Using VB.NET, how can I add a Layer at a certain position in the TOC? I'm able to add a layer, but I'm having trouble changing its index. In this example, I'm trying to send the added layer at the bottom of the TOC. The part in red is where I'm having trouble.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

Dim pMap As IMap = My.ArcMap.Document.ActiveView
Dim lyr As ILayerFile = New LayerFile()
Dim parcels As String = "D:\Parcels.lyr"

If System.IO.File.Exists(parcels) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.Open(parcels)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pLayer As ILayer = lyr.Layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; pMap.AddLayer(pLayer)
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;pMap.setLayerIndex(pLayer, pMap.LayerCount + 1)&lt;/STRONG&gt;
Else
&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox(parcels + " cannot be found")
End If
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 16:07:19 GMT</pubDate>
    <dc:creator>DaveCouture</dc:creator>
    <dc:date>2021-12-12T16:07:19Z</dc:date>
    <item>
      <title>Set Layer Index for Added Layer</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/set-layer-index-for-added-layer/m-p/158018#M4152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Using VB.NET, how can I add a Layer at a certain position in the TOC? I'm able to add a layer, but I'm having trouble changing its index. In this example, I'm trying to send the added layer at the bottom of the TOC. The part in red is where I'm having trouble.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

Dim pMap As IMap = My.ArcMap.Document.ActiveView
Dim lyr As ILayerFile = New LayerFile()
Dim parcels As String = "D:\Parcels.lyr"

If System.IO.File.Exists(parcels) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.Open(parcels)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pLayer As ILayer = lyr.Layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; pMap.AddLayer(pLayer)
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;pMap.setLayerIndex(pLayer, pMap.LayerCount + 1)&lt;/STRONG&gt;
Else
&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox(parcels + " cannot be found")
End If
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:07:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/set-layer-index-for-added-layer/m-p/158018#M4152</guid>
      <dc:creator>DaveCouture</dc:creator>
      <dc:date>2021-12-12T16:07:19Z</dc:date>
    </item>
  </channel>
</rss>

