Solved! Go to Solution.
If featureLayer IsNot Nothing Then Dim menuUID As New ESRI.ArcGIS.esriSystem.UID menuUID.Value = "esriArcMapUI.FeatureLayerEditMenu" Dim commandBar As ICommandBar = app.Document.CommandBars.Find(menuUID) If commandBar IsNot Nothing Then Dim itemUID As New ESRI.ArcGIS.esriSystem.UID itemUID.Value = "esriArcMapUI.LayerStartEditingCommand" Dim cmdItem As ICommandItem = commandBar.Find(itemUID) If cmdItem IsNot Nothing Then DirectCast(app.Document, ESRI.ArcGIS.ArcMapUI.IMxDocument).ContextItem = featureLayer cmdItem.Execute() End If End If End If
if(workspace.getType() == com.esri.arcgis.geodatabase.esriWorkspaceType.esriLocalDatabaseWorkspace){ Workspace workspaceLocalDB = new Workspace(dataset.getWorkspace()); // Cast the workspace to an IWorkspaceEdit and start an edit session. IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspaceLocalDB; workspaceEdit.startEditing(true); // you would get an automation exception here if it fails. // Start an edit operation. workspaceEdit.startEditOperation(); feature.store(); // Stop the edit operation. workspaceEdit.stopEditOperation(); // Stop the edit session. workspaceEdit.stopEditing(true); }
When the Edit Features -> Start Editing context menu item of a layer in the ArcMap TOC is clicked - ArcMap knows which layer to start editing on - and therefore doesn't need to present the user with the dialog to select which layer/workspace to start editing. It still evaluates all layers and presents the warning/error dialog if any issues are detected. This is what I'm trying to accomplish.
Interestingly, the warning/error dialog appears to display issues related to ALL layers in the active data frames table of contents - NOT just the ones being edited. The dialog attachment from my last post shows warnings for 5 layers. Two of these layers were from the workspace (FGDB) that I started an edit session on, the other three were from an SDE workspace.
Then the account you are using must already have edit access to these. Are the featureclasses versioned? Is that an SDE Workgroup or Enterprise license?
If featureLayer IsNot Nothing Then Dim menuUID As New ESRI.ArcGIS.esriSystem.UID menuUID.Value = "esriArcMapUI.FeatureLayerEditMenu" Dim commandBar As ICommandBar = app.Document.CommandBars.Find(menuUID) If commandBar IsNot Nothing Then Dim itemUID As New ESRI.ArcGIS.esriSystem.UID itemUID.Value = "esriArcMapUI.LayerStartEditingCommand" Dim cmdItem As ICommandItem = commandBar.Find(itemUID) If cmdItem IsNot Nothing Then DirectCast(app.Document, ESRI.ArcGIS.ArcMapUI.IMxDocument).ContextItem = featureLayer cmdItem.Execute() End If End If End If