afairbarns

Editing table attributes of a layer file .NET

Discussion created by afairbarns on Jun 3, 2011
Latest reply on Sep 20, 2011 by tgisarc
Hi everyone!

I have been at this for a while, so any help would be appreciated.

I am creating an add-in using .NET Studio 2008 and contains a button and a dockable window. When the user opens arcmap all they have to do is click on the add-in toolbar button, and it adds a specifed layer file (uses dxLayer/File) and the dockable window. So far so good. The user can change values on the dockable window, to update field attributes in the layer. My question is therefore, HOW DO I GET ARCMAP TO CONNECT TO (AND EDIT) THE LAYER'S TABLE OUTISIDE OF AN EDIT SESSION?

Most of what i have looked at uses workspaces, but of course the layer has been added to a blank session with no geodatabase or mxd attached. How do i get the workspace? My layer is as IFeatureLayer and can also be as IFeatureClass. I tried getting the workspace using:

Dim dataset As ESRI.ArcGIS.Geodatabase.IDataset = CType(mylayer, ESRI.ArcGIS.Geodatabase.IDataset)

Dim working As IWorkspace = dataset.Workspace

this works until i get to opening the class, casting workspace to workspace2 to find if its in an editing session - then it crashes arcmap. happens for every function that uses workspace. What is going on?????????


Thank you in advance

Outcomes