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.

artwork21
35.2k8 gold badges69 silver badges135 bronze badges
asked May 9, 2012 at 14:27
2
  • Are you wanting to start and stop an edit session by code or just save during an existing edit session? 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. 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()
answered May 9, 2012 at 14:40
1
  • I'll try this out later. Thank you. Sorry about posting this on the other question before. 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);
MrXsquared
36.2k22 gold badges76 silver badges127 bronze badges
answered Dec 7, 2019 at 0:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.