This content has been marked as final. Show 5 replies
If you are dealing with a layer, you need to cast it to Ifeaturelayer and retrieve the featureclass. Cast the featureclass to Idataset and get the workspace. The workspace type returned from the Ifeaturelayer as idataset may not implement iworkspace2.
If the featureclass is not annotation or in a topology or network, you should be able to edit it outside an edit session.
Thank You, thats exactly what ive been doing. I think i have found what is making it crash....arc cannot find the feature class dataset - it says feature dataset = nothing. When i look on the layer information it says it has a reference to a dataset on my desktop. Is there something special i need to do to get the dataset? so far my sub looks like this:
Private Sub cmd_Calculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_Calculate.Click
Dim currentDocument As IMxDocument = CType(My.ArcMap.Document, IMxDocument)
Dim currentMap As IMap = currentDocument.FocusMap
Dim activeView As IActiveView = My.ArcMap.Document.ActiveView
Dim collectionLayers As ESRI.ArcGIS.Carto.IEnumLayer = currentMap.Layers(Nothing, True)
If collectionLayers Is Nothing Then Exit Sub
Dim loopLayer As ESRI.ArcGIS.Carto.ILayer
loopLayer = collectionLayers.Next()
While loopLayer IsNot Nothing
If loopLayer.Name = "SSIM_Geological_Ranking" Then
Dim SSIMLayer As ESRI.ArcGIS.Carto.ILayer
SSIMLayer = loopLayer
Dim findSSIMlayerID As New SSIM_getlayerindex
Call findSSIMlayerID.GetIndexNumberFromLayerName(activeView, "SSIM_Geological_Ranking")
Dim SSIMlayerindex As Integer
SSIMlayerindex = findSSIMlayerID.i
Dim SSIMfeatureLayer As ESRI.ArcGIS.Carto.IFeatureLayer = CType(SSIMLayer, ESRI.ArcGIS.Carto.IFeatureLayer)
Dim SSIMfeatureClass As ESRI.ArcGIS.Geodatabase.IFeatureClass = SSIMfeatureLayer.FeatureClass
Dim SSIMdataset As ESRI.ArcGIS.Geodatabase.IDataset = CType(SSIMfeatureClass.FeatureDataset, ESRI.ArcGIS.Geodatabase.IDataset)
Dim SSIMworkspace As ESRI.ArcGIS.Geodatabase.IWorkspace = CType(SSIMdataset.Workspace, ESRI.ArcGIS.Geodatabase.IWorkspace)
Dim transactions As ITransactions = CType(SSIMworkspace, ITransactions)
Dim queryFilter As IQueryFilter = New QueryFilterClass()
queryFilter.WhereClause = "'Basin type' = 'Rift'"
queryFilter.SubFields = "'SSIM Basin Ranking'"
Dim updatecursor As IFeatureCursor = SSIMfeatureClass.Update(queryFilter, False)
Dim typeFieldIndex As Integer = SSIMfeatureClass.FindField("'SSIM Basin Ranking'")
Dim feature As IFeature = updatecursor.NextFeature()
Do While Not feature Is Nothing
feature.Value(typeFieldIndex) = "6"
feature = updatecursor.NextFeature()
MsgBox("Looped all transactions")
Catch comEx As COMException
Not all featureclasses belong to a feature dataset. It is entirely possible that it is a standalone featureclass. In that case featuredataset property will be nothing. However, you can get the workspace from the featureclass directly by casting the featureclass to Idataset.
Dim SSIMdataset As ESRI.ArcGIS.Geodatabase.IDataset = CType(SSIMfeatureClass, ESRI.ArcGIS.Geodatabase.IDataset)
TOP NOTCH - Thank you so much
I am new to ArcGIS and Silverlight.
I am writing an application that uses the IdentifyTask function to
identify the section the user clicked on.
This then displays a datagrid containing information relevant to
the section the user clicked, such as parcel name, the town name, the zoning of that
NOW, I want to be able to edit the parcel name, is this possible? How?
I am using an IDictionary object to populate the datagrid.