<?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: Trouble looping through a selection set where feature type is polyline which is part of a topology class. in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/trouble-looping-through-a-selection-set-where/m-p/473179#M12795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want people to help I suggest you edit your question and ensure formatting of code is on as it makes it easier to read. Have a look &lt;A _jive_internal="true" href="https://community.esri.com/blogs/sergent/2015/02/18/formatting-your-code-in-geonet-for-the-visual-learner"&gt;here&lt;/A&gt; if you do not know how to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you read the API help for the &lt;A href="http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#ISelectionSet2_Update.htm"&gt;Update&lt;/A&gt; method, it states at the bottom:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;All edits to features that participate in a Topology or Geometric Network must be bracketed within an edit operation.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code does not indicate if an Edit operation has been started so I'm guessing that is the issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Sep 2017 10:28:11 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2017-09-18T10:28:11Z</dc:date>
    <item>
      <title>Trouble looping through a selection set where feature type is polyline which is part of a topology class.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/trouble-looping-through-a-selection-set-where/m-p/473178#M12794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I have code that loops through selected features and updates an attribute for those features. &amp;nbsp;The code throws an error at runtime when the featureclass is a polyline type which participates in a topology class. &amp;nbsp;The error seems to happen at iSelectionset.Update. &amp;nbsp;Below is the entire function. &amp;nbsp;Any ideas would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Private Sub txtRFrom_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtRFrom.KeyPress&lt;BR /&gt; If Asc(e.KeyChar) = 13 Or Asc(e.KeyChar) = 9 Then&lt;BR /&gt; If cmbLayer.SelectedIndex = -1 Then&lt;BR /&gt; MsgBox("Please Select an Edit Layer!!")&lt;BR /&gt; Exit Sub&lt;BR /&gt; End If&lt;/P&gt;&lt;P&gt;Dim intValue As Integer&lt;/P&gt;&lt;P&gt;If Not Integer.TryParse(txtRFrom.Text, intValue) Then&lt;BR /&gt; txtRTo.Focus()&lt;BR /&gt; Exit Sub&lt;BR /&gt; End If&lt;/P&gt;&lt;P&gt;Dim pfLayer As IFeatureLayer&lt;BR /&gt; pfLayer = FindLayerByName(cmbLayer.SelectedItem)&lt;/P&gt;&lt;P&gt;Dim pfClass As IFeatureClass&lt;BR /&gt; pfClass = pfLayer.FeatureClass&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; Dim pfeatsel As IFeatureSelection&lt;BR /&gt; pfeatsel = pfLayer&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; Dim pSelectionSet As ISelectionSet2&lt;BR /&gt; pSelectionSet = pfeatsel.SelectionSet&lt;/P&gt;&lt;P&gt;If pSelectionSet.Count = 0 Then&lt;BR /&gt; MsgBox("No features selected!!")&lt;BR /&gt; Exit Sub&lt;BR /&gt; End If&lt;/P&gt;&lt;P&gt;Dim pFeatureCursor As IFeatureCursor&lt;BR /&gt; pFeatureCursor = Nothing&lt;/P&gt;&lt;P&gt;Dim pFeature As IFeature&lt;/P&gt;&lt;P&gt;'update the selectionset setting the IQueryFilter object to Nothing&lt;/P&gt;&lt;P&gt;pSelectionSet.Update(Nothing, False, pFeatureCursor)&lt;/P&gt;&lt;P&gt;pFeature = pFeatureCursor.NextFeature&lt;/P&gt;&lt;P&gt;Do Until pFeature Is Nothing&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; pFeature.Value(pFeature.Fields.FindField("RFromAddr")) = txtRFrom.Text&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;pFeatureCursor.UpdateFeature(pFeature)&lt;BR /&gt; pFeature = pFeatureCursor.NextFeature&lt;/P&gt;&lt;P&gt;txtRTo.Focus()&lt;BR /&gt; Loop&lt;BR /&gt; End If&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2017 12:26:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/trouble-looping-through-a-selection-set-where/m-p/473178#M12794</guid>
      <dc:creator>LawrenceHartpence</dc:creator>
      <dc:date>2017-08-31T12:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble looping through a selection set where feature type is polyline which is part of a topology class.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/trouble-looping-through-a-selection-set-where/m-p/473179#M12795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want people to help I suggest you edit your question and ensure formatting of code is on as it makes it easier to read. Have a look &lt;A _jive_internal="true" href="https://community.esri.com/blogs/sergent/2015/02/18/formatting-your-code-in-geonet-for-the-visual-learner"&gt;here&lt;/A&gt; if you do not know how to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you read the API help for the &lt;A href="http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#ISelectionSet2_Update.htm"&gt;Update&lt;/A&gt; method, it states at the bottom:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;All edits to features that participate in a Topology or Geometric Network must be bracketed within an edit operation.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code does not indicate if an Edit operation has been started so I'm guessing that is the issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Sep 2017 10:28:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/trouble-looping-through-a-selection-set-where/m-p/473179#M12795</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2017-09-18T10:28:11Z</dc:date>
    </item>
  </channel>
</rss>

