<?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 Re: How to insert row-values into an array? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-insert-row-values-into-an-array/m-p/131543#M3437</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I would like to insert the values of a row of an attribute table into an array. I know how to do this manually: &lt;BR /&gt;&lt;BR /&gt;Dim myArray()&lt;BR /&gt;myArray= Array("21621", "21612", "21624", .....)&lt;BR /&gt;&lt;BR /&gt;But I was wondering if you can use a loop to get the values automatically (using VBA).&lt;BR /&gt;Can anybody help? Thanks!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you mean get the values of the features from a Layer that is loaded in the TOC of ArcMap?&amp;nbsp; I don't work much with arrays, but try something like this (untested):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim pLayer as IFeatureLayer = pMap.Layer(0) 'gets the first layer in the TOC
Dim pFSel as IFeatureSelection = pLayer
Dim pFCursor as IFeatureCursor
pFSel.SelectionSet.Search(Nothing, False, pFCursor)

Dim myArray() As Array = New Array
Dim i As Integer
i = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
Dim pFeat as IFeature
pFeat = pFCursor.NextFeature

Dim valForArray As String
Do Until pFeat Is Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valForArray = pFeat.Value(pFeat.Fields.FindField("TheFieldName"))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myArray.Insert(i + 1, valForArray)
&amp;nbsp;&amp;nbsp; pFeat = pFCursor.NextFeature
Loop&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 07:23:09 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2021-12-11T07:23:09Z</dc:date>
    <item>
      <title>How to insert row-values into an array?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-insert-row-values-into-an-array/m-p/131542#M3436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to insert the values of a row of an attribute table into an array. I know how to do this manually: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim myArray()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;myArray= Array("21621", "21612", "21624", .....)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I was wondering if you can use a loop to get the values automatically (using VBA).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anybody help? Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 17:13:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-insert-row-values-into-an-array/m-p/131542#M3436</guid>
      <dc:creator>CK</dc:creator>
      <dc:date>2010-05-27T17:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert row-values into an array?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-insert-row-values-into-an-array/m-p/131543#M3437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I would like to insert the values of a row of an attribute table into an array. I know how to do this manually: &lt;BR /&gt;&lt;BR /&gt;Dim myArray()&lt;BR /&gt;myArray= Array("21621", "21612", "21624", .....)&lt;BR /&gt;&lt;BR /&gt;But I was wondering if you can use a loop to get the values automatically (using VBA).&lt;BR /&gt;Can anybody help? Thanks!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you mean get the values of the features from a Layer that is loaded in the TOC of ArcMap?&amp;nbsp; I don't work much with arrays, but try something like this (untested):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim pLayer as IFeatureLayer = pMap.Layer(0) 'gets the first layer in the TOC
Dim pFSel as IFeatureSelection = pLayer
Dim pFCursor as IFeatureCursor
pFSel.SelectionSet.Search(Nothing, False, pFCursor)

Dim myArray() As Array = New Array
Dim i As Integer
i = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
Dim pFeat as IFeature
pFeat = pFCursor.NextFeature

Dim valForArray As String
Do Until pFeat Is Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valForArray = pFeat.Value(pFeat.Fields.FindField("TheFieldName"))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myArray.Insert(i + 1, valForArray)
&amp;nbsp;&amp;nbsp; pFeat = pFCursor.NextFeature
Loop&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:23:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-insert-row-values-into-an-array/m-p/131543#M3437</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T07:23:09Z</dc:date>
    </item>
  </channel>
</rss>

