lordlightking

some problems with FeatureClass.Update

Discussion created by lordlightking on Nov 28, 2010
Latest reply on Nov 29, 2010 by lordlightking
Hello guys

I am a little bit new into the ArcObjects, so i apologyse for any big mistake. I wanted to know if you could help me. I have to do a feature update. I get the feature from a form, I have done this already, the problem is when I try to put the cursor inside the old feature, and I don't know what happend with that. I send the code so that you can help me. I appreciate the collaboration and rapid response.

Dim espacioFactory As IWorkspaceFactory
Dim espacioTrabajo As IWorkspace
espacioFactory = New AccessWorkspaceFactory
espacioTrabajo = espacioFactory.OpenFromFile(path, 0)
Dim espacioFeature As IFeatureWorkspace
espacioFeature = espacioTrabajo
Dim espacioTrabajoEdit As IWorkspaceEdit
espacioTrabajoEdit = espacioFeature

'strart  editor

espacioTrabajoEdit.StartEditing(True)
espacioTrabajoEdit.StartEditOperation()
Select Case geometry
    Case esriGeometryType.esriGeometryPoint
          feature.Shape = elemento
    Case esriGeometryType.esriGeometryPolygon
          feature.Shape = elemento
    Case esriGeometryType.esriGeometryPolyline
           feature.Shape = elemento
End Select
Dim queryFilter As IQueryFilter
queryFilter = New QueryFilter
Dim str As String = "OID=" & oid
queryFilter.WhereClause = str
Dim cursor1 As IFeatureCursor
cursor1 = tablafeature.Update(queryFilter, False)
Dim Row As DataGridViewRow = New DataGridViewRow()
Dim i As Integer = 2
For Each Row In dgvDatos.Rows
        For j = 0 To dgvDatos.Columns.Count - 1
             If i < 7 Then
                  If j = 2 Then
                     feature.Value(i) = Row.Cells(j).Value
                     i += 1
                  End If
             Else
                  Exit Try
             End If
         Next
   Next
cursor1.UpdateFeature(feature)

'stop editor
espacioTrabajoEdit.StopEditOperation()
espacioTrabajoEdit.StopEditing(True)

Outcomes