1

I have figured out how to do a map save document, but I would also like to be able to save edits whether or not I am also saving the map document.

2
  • Are you wanting to start and stop an edit session by code or just save during an existing edit session?
    – artwork21
    Commented May 9, 2012 at 14:30
  • I just want to save the edits when I have already started an edit session. I also don't want it to stop the edit session.
    – Xoph
    Commented May 9, 2012 at 14:31

2 Answers 2

5

You can save edits using ArcMap Command Save Edits, see code below. This will not stop the edit session.

Dim pUID As New UID
Dim pCmdItem As ICommandItem
' Use the GUID of the Save command
pUID.Value = "{59D2AFD2-9EA2-11D1-9165-0080C718DF97}"
' or you can use the ProgID
' pUID.Value = "esriEditor.SaveEditsCommand"
pUID.SubType = 3
pCmdItem = My.ArcMap.Application.Document.CommandBars.Find(pUID)
pCmdItem.Execute()
1
  • I'll try this out later. Thank you. Sorry about posting this on the other question before.
    – Xoph
    Commented May 9, 2012 at 15:09
1

In looking for this answer I ran across ESRI documentation that indicates the Save Edits command does perform a stop/start on the edit session. So the edit session is being stopped (and saved), but then a new session is immediately being started.

Most editor methods for managing an edit session have a direct correlation to geodatabase methods. This is also true from the Editor's UI with the exception of the Save Edits command. In this case, the Editor's Save Edits command calls IWorkspaceEdit.StopEditing(True) and IWorkspaceEdit.StartEditing internally.

If you have a reference to the workspace object being edited this does the same as @artwork21's answer, in C#, though, as my VB.net is rusty.

IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;
bool saveEdits = true;
workspaceEdit.StopEditing(saveEdits);
bool withUndoRedo = true;
workspaceEdit.StartEditing(withUndoRedo);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.