<?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: Select/Loop through features, one at a time in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61581#M1695</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i am not sure if I understand your logic (because features are independant of one another).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'get a reference to the feature Layer pFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dim pFeatureSelection as IFeatureSelection = pFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dim pSelectionSet as ISelectionSet =&amp;nbsp; pFeatureSelection.SelectionSet&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dim pFeatureCursor as IFeatureCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pSelectionSet.Search Nothing, true, pFeatureCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;set pFeature as IFeature = pFeatureCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do While not pFeature is Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; 'do Something&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; 'next Feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; set pFeature as IFeature = pFeatureCursor.NextFeature&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Susan&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-- &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Susan Jones&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GIS Consultant&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Spatial Logic Ltd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Auckland, NEW ZEALAND&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Email: &lt;/SPAN&gt;&lt;A href="mailto:sjones@spatiallogic.co.nz"&gt;sjones@spatiallogic.co.nz&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.spatiallogic.co.nz"&gt;http://www.spatiallogic.co.nz&lt;/A&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Oct 2011 19:22:24 GMT</pubDate>
    <dc:creator>SusanJones</dc:creator>
    <dc:date>2011-10-12T19:22:24Z</dc:date>
    <item>
      <title>Select/Loop through features, one at a time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61571#M1685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am wanting to create a tool where I can click a button and it will either select the first record of a specific featurelayer, or if there is already a feature selected it will unselect that feature and select the next one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I tell it to select very first record (ie lowest objectid) in the featurelayer?&amp;nbsp; Or if there is already a feature selected, how do I tell it to select the next record?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think this should be too hard, I've just come up blank when trying to figure it out this morning.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Really all I'm doing is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If nothing selected, select Row 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else if something selected, select Row(selected)+1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying this currently in VBA, but will be moving to .Net once I've got something working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 22:54:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61571#M1685</guid>
      <dc:creator>MikeLouwrens</dc:creator>
      <dc:date>2011-09-06T22:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Loop through features, one at a time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61572#M1686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;this code (from &lt;/SPAN&gt;&lt;A href="http://forums.esri.com/thread.asp?c=93&amp;amp;f=992&amp;amp;t=289076" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.esri.com/thread.asp?c=93&amp;amp;f=992&amp;amp;t=289076&lt;/A&gt;&lt;SPAN&gt;) almost does what I need, except that it seems to ignore my Definition Query (one feature class has 168 feature total, but with the definition query in place there are only 5 records I want to look at, but this code still selects from all 168 features).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: Actually it doesn't quite do what I want, as it doesn't start again if the selection clears. /EDIT&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Private pFCursor As IFeatureCursor

Private Sub UIButtonControl1_Click()

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMxDoc As IMxDocument
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMap As IMap
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pLayer As ILayer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pFLayer As IFeatureLayer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pFeature As IFeature

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMxDoc = ThisDocument
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMap = pMxDoc.FocusMap
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pLayer = pMap.Layer(0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFLayer = pLayer

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If pFCursor Is Nothing Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFCursor = pFLayer.FeatureClass.Search(Nothing, False)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFeature = pFCursor.NextFeature
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pMap.ClearSelection
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pMap.SelectFeature pLayer, pFeature

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pMxDoc.ActiveView.Refresh

End Sub
&lt;/PRE&gt;&lt;SPAN&gt;Mike.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:20:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61572#M1686</guid>
      <dc:creator>MikeLouwrens</dc:creator>
      <dc:date>2021-12-10T22:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Loop through features, one at a time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61573#M1687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To respect the definition query for a layer, use IFeatureLayer.Search.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Replace:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFCursor = pFLayer.FeatureClass.Search(Nothing, False)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFCursor = pFLayer.Search(Nothing, False)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 02:23:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61573#M1687</guid>
      <dc:creator>JeffreyHamblin</dc:creator>
      <dc:date>2011-09-07T02:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Loop through features, one at a time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61574#M1688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The thing to keep in mind is that the ObjectIds are not necessarily in sequential order.&amp;nbsp; If features have been deleted, then there will be gaps in the ids.&amp;nbsp; So, you can't simply +1 the OID to query for the next feature.&amp;nbsp; I would suggest keeping an array of OIDs instead of trying to query for the next feature.&amp;nbsp; The first time the button is clicked, it will initialize the array by querying for all features in the layer and adding their OIDs to the array.&amp;nbsp; Use IQueryFilterDefinition to specify an ORDER BY clause to sort on the OID field (or you can just sort the array after you've added all of the OIDs).&amp;nbsp; The first time through you will query for and select the feature whose OID is at index 0 in the array.&amp;nbsp; After that, you get the OID of the selected feature, find the index position in the array that contains that OID and then get the OID at the next index position.&amp;nbsp; Also, use IFeatureClass.GetFeature instead of using a query filter to select the individual features.&amp;nbsp; It's faster.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 12:31:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61574#M1688</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2011-09-07T12:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Loop through features, one at a time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61575#M1689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there, Neil's method of getting the ObjectId is probably optimal if the featureclass is not being edited at the time.&amp;nbsp; If it is you can probably do a search on the IfeatureLayer with a QueryFilter where objectid &amp;gt; theSelectedObjectID, get the first feature in the cursor and use that id. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As far as making the selection, I suggest you use IfeatureSelection.Clear, IFeatureSelection.SelectionSet.Add(ObjectId) and Call IfeatureSelection.ChangeSelection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if you have no query definition and you have a very large featureclass (hundreds of thousands of records), it might actually be more efficient, to find the objectID from the selection (ISelectionSet.Ids), increment it can call IfeatureClass.GetFeature, trap the exception and keep going until you find a valid feature.&amp;nbsp; Keep in mind error trapping in .Net is usually not efficient and to be avoided.&amp;nbsp; However, this might be faster than running queries on very large tables.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 13:38:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61575#M1689</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-09-07T13:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Loop through features, one at a time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61576#M1690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;To respect the definition query for a layer, use IFeatureLayer.Search.&lt;BR /&gt;&lt;BR /&gt;Replace:&lt;BR /&gt;Set pFCursor = pFLayer.FeatureClass.Search(Nothing, False)&lt;BR /&gt;&lt;BR /&gt;With:&lt;BR /&gt;Set pFCursor = pFLayer.Search(Nothing, False)&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I got an "Automation Error" when I tried changing this.&amp;nbsp; If I remove the definition query this works fine, but put it back and I get Automation Error again.&amp;nbsp; Leaving the 'FeatureClass' part in I don't get the Automation Error (but doesn't follow the definition query)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2011 01:33:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61576#M1690</guid>
      <dc:creator>MikeLouwrens</dc:creator>
      <dc:date>2011-09-08T01:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Loop through features, one at a time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61577#M1691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi there, Neil's method of getting the ObjectId is probably optimal if the featureclass is not being edited at the time.&amp;nbsp; If it is you can probably do a search on the IfeatureLayer with a QueryFilter where objectid &amp;gt; theSelectedObjectID, get the first feature in the cursor and use that id. &lt;BR /&gt;&lt;BR /&gt;As far as making the selection, I suggest you use IfeatureSelection.Clear, IFeatureSelection.SelectionSet.Add(ObjectId) and Call IfeatureSelection.ChangeSelection.&lt;BR /&gt;&lt;BR /&gt;if you have no query definition and you have a very large featureclass (hundreds of thousands of records), it might actually be more efficient, to find the objectID from the selection (ISelectionSet.Ids), increment it can call IfeatureClass.GetFeature, trap the exception and keep going until you find a valid feature.&amp;nbsp; Keep in mind error trapping in .Net is usually not efficient and to be avoided.&amp;nbsp; However, this might be faster than running queries on very large tables.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; I'm not editing the data, but I do always have a definition query on (most feature classes have 10000+ features (one has 50000), but are filtered down to approximately 200 with the definition query.&amp;nbsp; it is these remaining records that I want to step through.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2011 01:35:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61577#M1691</guid>
      <dc:creator>MikeLouwrens</dc:creator>
      <dc:date>2011-09-08T01:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Loop through features, one at a time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61578#M1692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I got an "Automation Error" when I tried changing this.&amp;nbsp; If I remove the definition query this works fine, but put it back and I get Automation Error again.&amp;nbsp; Leaving the 'FeatureClass' part in I don't get the Automation Error (but doesn't follow the definition query)&lt;BR /&gt;&lt;BR /&gt;Mike.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Interesting. What type of datasource are you working with? And what version of ArcMap?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another option is to grab the definition query from the feature layer and use that to construct the QueryFilter for the Search method on the feature class. The FeatureLayer class implements ITableDefinition which has a DefinitionExpression property.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So something like this in VBA (untested, but I've used the concept in C# add-ins):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Dim pTableDefinition As ITableDefinition 
Set pTableDefinition = pFLayer
Dim pQueryFilter As IQueryFilter
Set pQueryFilter = New QueryFilter
pQueryFilter.WhereClause = pTableDefinition.DefinitionExpression
pQueryFilter.SubFields = "*"
...
Set pFCursor = pFLayer.FeatureClass.Search(pQueryFilter, False)
 
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:20:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61578#M1692</guid>
      <dc:creator>JeffreyHamblin</dc:creator>
      <dc:date>2021-12-10T22:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Loop through features, one at a time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61579#M1693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Interesting. What type of datasource are you working with? And what version of ArcMap?&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;SDE point or line feature class, joined to SQL table, definition query on SQL table.&amp;nbsp; ArcMap 10.0 (fully patched)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; I'm on leave for the weekend, so I'll have more of a play when I return on Monday.&amp;nbsp; To me the whole idea doesn't seem very complex, but in practice it's getting quite complicated.&amp;nbsp; Maybe I'm over thinking it? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2011 02:52:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61579#M1693</guid>
      <dc:creator>MikeLouwrens</dc:creator>
      <dc:date>2011-09-08T02:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Loop through features, one at a time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61580#M1694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;kia Ora Mike&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;create yourself a selection set from the feature Layer. from here you'll be able to get a cursor of just the selection set features. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Susan&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-- &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Susan Jones&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GIS Consultant&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Spatial Logic Ltd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Auckland, NEW ZEALAND&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Email: &lt;/SPAN&gt;&lt;A href="mailto:sjones@spatiallogic.co.nz"&gt;sjones@spatiallogic.co.nz&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.spatiallogic.co.nz"&gt;http://www.spatiallogic.co.nz&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Oct 2011 01:41:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61580#M1694</guid>
      <dc:creator>SusanJones</dc:creator>
      <dc:date>2011-10-12T01:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Select/Loop through features, one at a time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61581#M1695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i am not sure if I understand your logic (because features are independant of one another).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'get a reference to the feature Layer pFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dim pFeatureSelection as IFeatureSelection = pFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dim pSelectionSet as ISelectionSet =&amp;nbsp; pFeatureSelection.SelectionSet&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dim pFeatureCursor as IFeatureCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pSelectionSet.Search Nothing, true, pFeatureCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;set pFeature as IFeature = pFeatureCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do While not pFeature is Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; 'do Something&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; 'next Feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; set pFeature as IFeature = pFeatureCursor.NextFeature&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Susan&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-- &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Susan Jones&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GIS Consultant&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Spatial Logic Ltd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Auckland, NEW ZEALAND&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Email: &lt;/SPAN&gt;&lt;A href="mailto:sjones@spatiallogic.co.nz"&gt;sjones@spatiallogic.co.nz&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.spatiallogic.co.nz"&gt;http://www.spatiallogic.co.nz&lt;/A&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Oct 2011 19:22:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/select-loop-through-features-one-at-a-time/m-p/61581#M1695</guid>
      <dc:creator>SusanJones</dc:creator>
      <dc:date>2011-10-12T19:22:24Z</dc:date>
    </item>
  </channel>
</rss>

