<?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 If Edit Session On Then... in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/if-edit-session-on-then/m-p/294025#M7645</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How can I check if the Edit Session is on?&amp;nbsp; With my current code, ArcMap crashes when not in Edit Session.&amp;nbsp; I'd like to put a warning for the user to start an Edit Session, if they forgot.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&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 pEnumFeature As ESRI.ArcGIS.Geodatabase.IEnumFeature &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pFeature As ESRI.ArcGIS.Geodatabase.IFeature &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pEditor As ESRI.ArcGIS.Editor.IEditor &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim featureCode As String &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim def As String&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pEditor = My.ArcMap.Application.FindExtensionByName("esriEditor.Editor") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pEnumFeature = pEditor.EditSelection &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pEnumFeature.Reset() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeature = pEnumFeature.Next &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pEditor.StartOperation()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Jun 2012 17:06:43 GMT</pubDate>
    <dc:creator>DaveCouture</dc:creator>
    <dc:date>2012-06-28T17:06:43Z</dc:date>
    <item>
      <title>If Edit Session On Then...</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/if-edit-session-on-then/m-p/294025#M7645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How can I check if the Edit Session is on?&amp;nbsp; With my current code, ArcMap crashes when not in Edit Session.&amp;nbsp; I'd like to put a warning for the user to start an Edit Session, if they forgot.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&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 pEnumFeature As ESRI.ArcGIS.Geodatabase.IEnumFeature &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pFeature As ESRI.ArcGIS.Geodatabase.IFeature &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pEditor As ESRI.ArcGIS.Editor.IEditor &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim featureCode As String &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim def As String&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pEditor = My.ArcMap.Application.FindExtensionByName("esriEditor.Editor") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pEnumFeature = pEditor.EditSelection &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pEnumFeature.Reset() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeature = pEnumFeature.Next &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pEditor.StartOperation()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 17:06:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/if-edit-session-on-then/m-p/294025#M7645</guid>
      <dc:creator>DaveCouture</dc:creator>
      <dc:date>2012-06-28T17:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: If Edit Session On Then...</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/if-edit-session-on-then/m-p/294026#M7646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Use IEditor.EditState property &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 17:18:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/if-edit-session-on-then/m-p/294026#M7646</guid>
      <dc:creator>ThavitinaiduGulivindala</dc:creator>
      <dc:date>2012-06-28T17:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: If Edit Mode On Then...</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/if-edit-session-on-then/m-p/294027#M7647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Do you have error handling in your code?&amp;nbsp; I don't see it in what you've posted.&amp;nbsp; It's up to you as the developer to handle errors within your own code (that's not something that ArcMap could do for you).&amp;nbsp; All of your code should be within Try/Catch blocks at points where exceptions would be thrown out to the ArcMap application.&amp;nbsp; You should also place Try/Catch blocks within your call stack at points where it makes sense (where those points are is up to you).&amp;nbsp; In the code you've posted, you're starting an edit operation without first starting an edit session.&amp;nbsp; This isn't allowed.&amp;nbsp; You must first called IEditor.StartEditing and pass in a reference to the workspace you want to edit.&amp;nbsp; You can also preface that by checking IEditor.EditState to see if an edit session has already been started and then check IEditor.EditWorkspace to see if the edit session has been started on the workspace you want to edit.&amp;nbsp; If the edit session has not been started, then you will need to start it yourself.&amp;nbsp; If it has been started but on a different workspace then you should stop the current edit session and start a new one.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 17:18:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/if-edit-session-on-then/m-p/294027#M7647</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2012-06-28T17:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: If Edit Session On Then...</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/if-edit-session-on-then/m-p/294028#M7648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can check the edit state by using IEditor::Editstate. An example to check whether an edit session has been started on the selected map:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;If My.ArcMap.Editor.EditState &amp;lt;&amp;gt; ESRI.ArcGIS.Editor.esriEditState.esriStateEditing then&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As for ArcMap crashing, do you use Try..Catch exception handling?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 17:21:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/if-edit-session-on-then/m-p/294028#M7648</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2012-06-28T17:21:04Z</dc:date>
    </item>
  </channel>
</rss>

