//http://resources.esri.com/help/9.3/ArcGISDesktop/dotnet/2626201e-de60-4bab-bb1c-d16fcd4f8c4b.htm#NETFeature private void startEditing(ESRI.ArcGIS.Framework.IApplication ArcMap) { ESRI.ArcGIS.Geodatabase.IFeatureClass m_featureClass; ESRI.ArcGIS.Editor.IEditor m_editor; ESRI.ArcGIS.ArcMapUI.IMxDocument mxDocument = (ESRI.ArcGIS.ArcMapUI.IMxDocument)ArcMap.Document; ESRI.ArcGIS.ArcMapUI.IContentsView curTOC = mxDocument.CurrentContentsView; //Create a method to get a reference to the feature class or add the ArcGIS Desktop snippet. //http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Get_FeatureClass_of_Selected_Feature_Layer_in_Contents_View_Snippet/00490000004r000000/ m_featureClass = ArcMapHelperFunctions.GetFeatureClassOfSelectedFeatureLayerInContentsView(curTOC); //Once the feature class has been referenced, get the workspace to edit by creating an IFeatureWorkspace //and setting an IWorkspace object to the feature workspace using a cast. ESRI.ArcGIS.Geodatabase.IFeatureWorkspace featWork = m_featureClass.FeatureDataset.Workspace as ESRI.ArcGIS.Geodatabase.IFeatureWorkspace; ESRI.ArcGIS.Geodatabase.IWorkspace editWorkspace = featWork as ESRI.ArcGIS.Geodatabase.IWorkspace; //Start an edit session on the workspace holding the feature class, which must be in a feature dataset. ESRI.ArcGIS.esriSystem.UID editorUid = new ESRI.ArcGIS.esriSystem.UID(); editorUid.Value = "esriEditor.Editor"; m_editor = ArcMapHelperFunctions.app.FindExtensionByCLSID(editorUid) as ESRI.ArcGIS.Editor.IEditor3; m_editor.StartEditing(editWorkspace); }
Solved! Go to Solution.
//http://resources.esri.com/help/9.3/ArcGISDesktop/dotnet/2626201e-de60-4bab-bb1c-d16fcd4f8c4b.htm#NETFeature
private void startEditing(ESRI.ArcGIS.Framework.IApplication ArcMap)
{
ESRI.ArcGIS.Geodatabase.IFeatureClass m_featureClass;
ESRI.ArcGIS.Editor.IEditor m_editor;
ESRI.ArcGIS.ArcMapUI.IMxDocument mxDocument = (ESRI.ArcGIS.ArcMapUI.IMxDocument)ArcMap.Document;
ESRI.ArcGIS.ArcMapUI.IContentsView curTOC = mxDocument.CurrentContentsView;
//Create a method to get a reference to the feature class or add the ArcGIS Desktop snippet.
//http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Get_FeatureClass_of_Selected_Feature_Layer_in_Contents_View_Snippet/00490000004r000000/
m_featureClass = ArcMapHelperFunctions.GetFeatureClassOfSelectedFeatureLayerInContentsView(curTOC);
//Once the feature class has been referenced, get the workspace to edit by creating an IFeatureWorkspace
//and setting an IWorkspace object to the feature workspace using a cast.
ESRI.ArcGIS.Geodatabase.IWorkspace editWorkspace = (m_featureClass as ESRI.ArcGIS.Geodatabase.IDataset).Workspace;
//Start an edit session on the workspace holding the feature class, which must be in a feature dataset.
ESRI.ArcGIS.esriSystem.UID editorUid = new ESRI.ArcGIS.esriSystem.UID();
editorUid.Value = "esriEditor.Editor";
m_editor = ArcMapHelperFunctions.app.FindExtensionByCLSID(editorUid) as ESRI.ArcGIS.Editor.IEditor3;
m_editor.StartEditing(editWorkspace);
}
Sorry, yes. I meant IDataset instead of IGeoDataset.