<?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: Pick new points of a feature in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/pick-new-points-of-a-feature/m-p/1065151#M20323</link>
    <description>&lt;P&gt;Firstly when posting code please insert it and set the language&amp;nbsp; using the &amp;lt;/&amp;gt; tool on the toolbar, to see it you need to click on the 3 dots icon. It makes it easier for people to read your code and help you.&lt;/P&gt;&lt;P&gt;Below is a VBA script knocked together and it functioned as expected (note the syntax colouring...)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Public Sub test()
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
Dim pMap As IMap
Set pMap = pMxDoc.FocusMap
Dim pEnumFeat As IEnumFeature
Set pEnumFeat = pMap.FeatureSelection
pEnumFeat.Reset

Dim enumFeatSetup As IEnumFeatureSetup
Set enumFeatSetup = pEnumFeat
enumFeatSetup.AllFields = True

Dim pFeat As IFeature
Set pFeat = pEnumFeat.Next

Dim i As Integer
i = pFeat.Fields.FindField("PROV_NAME")

Do While Not pFeat Is Nothing
    Debug.Print pFeat.Value(i)
    Set pFeat = pEnumFeat.Next
Loop
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So this worked for me which made me wonder if you understand what&amp;nbsp;&lt;EM&gt;pMap.FeatureSelection&lt;/EM&gt; is doing. It's returning an enumerator over ALL selections in ALL layers in the map. Your code logic is assuming that ALL layers with a selection have an&amp;nbsp;&lt;EM&gt;INDEX&lt;/EM&gt; and &lt;EM&gt;UNIQUE&lt;/EM&gt; field. Is this your intention?&lt;/P&gt;&lt;P&gt;If you intend to update a single layer then its much safer to get the selection set from&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#IFeatureSelection.htm" target="_self"&gt;IFeatureSelection&lt;/A&gt; which has been cast to point to a single FeatureLayer.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Jun 2021 15:38:12 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2021-06-04T15:38:12Z</dc:date>
    <item>
      <title>Pick new points of a feature</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/pick-new-points-of-a-feature/m-p/1063713#M20322</link>
      <description>&lt;P&gt;Good day All,&lt;/P&gt;&lt;P&gt;I am unable to figure out how to find all features using ArcObjects 10.6. My code is working on selected feature (1 point) only. It doesn't work on multiple points added.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is in vb.net. Any help is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim pMxDoc As IMxDocument&lt;BR /&gt;pMxDoc = CType(My.ArcMap.Application.Document, IMxDocument)&lt;BR /&gt;Dim pMap As IMap&lt;BR /&gt;pMap = pMxDoc.FocusMap&lt;BR /&gt;Dim pEnumFeat As IEnumFeature = TryCast(pMap.FeatureSelection, IEnumFeature)&lt;BR /&gt;pEnumFeat.Reset()&lt;BR /&gt;Dim pFeat As IFeature = pEnumFeat.Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If pFeat Is Nothing Then&lt;BR /&gt;MessageBox.Show("No Feature Selected.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)&lt;BR /&gt;System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumFeat)&lt;BR /&gt;Return&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;Dim pFields As IFields&lt;BR /&gt;Dim enumFeatSetup As IEnumFeatureSetup = CType(pEnumFeat, IEnumFeatureSetup)&lt;BR /&gt;enumFeatSetup.AllFields = True&lt;/P&gt;&lt;P&gt;While pFeat IsNot Nothing&lt;BR /&gt;' How to loop through all new poins added?&lt;BR /&gt;pFields = pFeat.Fields&lt;/P&gt;&lt;P&gt;sIndex = pFeat.Value(pFeat.Fields.FindField("INDEX"))&lt;/P&gt;&lt;P&gt;sUni = GetUniqueValue(sIndex)&lt;/P&gt;&lt;P&gt;pFeat.Value(pFeat.Fields.FindField("UNIQUE")) =sUni&lt;BR /&gt;pFeat.Store()&lt;/P&gt;&lt;P&gt;pFeat = pEnumFeat.Next&lt;BR /&gt;End While&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jun 2021 17:27:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/pick-new-points-of-a-feature/m-p/1063713#M20322</guid>
      <dc:creator>rajujee</dc:creator>
      <dc:date>2021-06-01T17:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Pick new points of a feature</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/pick-new-points-of-a-feature/m-p/1065151#M20323</link>
      <description>&lt;P&gt;Firstly when posting code please insert it and set the language&amp;nbsp; using the &amp;lt;/&amp;gt; tool on the toolbar, to see it you need to click on the 3 dots icon. It makes it easier for people to read your code and help you.&lt;/P&gt;&lt;P&gt;Below is a VBA script knocked together and it functioned as expected (note the syntax colouring...)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Public Sub test()
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
Dim pMap As IMap
Set pMap = pMxDoc.FocusMap
Dim pEnumFeat As IEnumFeature
Set pEnumFeat = pMap.FeatureSelection
pEnumFeat.Reset

Dim enumFeatSetup As IEnumFeatureSetup
Set enumFeatSetup = pEnumFeat
enumFeatSetup.AllFields = True

Dim pFeat As IFeature
Set pFeat = pEnumFeat.Next

Dim i As Integer
i = pFeat.Fields.FindField("PROV_NAME")

Do While Not pFeat Is Nothing
    Debug.Print pFeat.Value(i)
    Set pFeat = pEnumFeat.Next
Loop
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So this worked for me which made me wonder if you understand what&amp;nbsp;&lt;EM&gt;pMap.FeatureSelection&lt;/EM&gt; is doing. It's returning an enumerator over ALL selections in ALL layers in the map. Your code logic is assuming that ALL layers with a selection have an&amp;nbsp;&lt;EM&gt;INDEX&lt;/EM&gt; and &lt;EM&gt;UNIQUE&lt;/EM&gt; field. Is this your intention?&lt;/P&gt;&lt;P&gt;If you intend to update a single layer then its much safer to get the selection set from&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#IFeatureSelection.htm" target="_self"&gt;IFeatureSelection&lt;/A&gt; which has been cast to point to a single FeatureLayer.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 15:38:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/pick-new-points-of-a-feature/m-p/1065151#M20323</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-06-04T15:38:12Z</dc:date>
    </item>
  </channel>
</rss>

