chaitugk

Please help me with this code:

Discussion created by chaitugk on Feb 1, 2011
Latest reply on Feb 2, 2011 by chaitugk
Hi,
I am programming in VB.Net in ArcGIS Engine, I am using the following function for updating some records. The code is working properly, but only for the first time. Second time I use this function, it is showing me a COM error.

    Public Sub updFeatureDouble(ByVal fname As String, ByVal fvalue As Double)

        Dim map As IMap = axMapControl1.ActiveView.FocusMap
        Dim mlayer As ILayer = CType(axMapControl1.ActiveView.FocusMap.Layer(1), ILayer)
        Dim activeview As IActiveView = axMapControl1.ActiveView


        Dim pfselection As IFeatureSelection = CType(mlayer, IFeatureSelection)
        Dim table As ITable = CType(pfselection, ITable)
        Dim pin As Integer = pfselection.SelectionSet.Count

        Dim enumOID As IEnumIDs = pfselection.SelectionSet.IDs
        Dim oid As Integer = enumOID.Next

        Dim row As IRow = Nothing
        Dim i As Integer
        For i = 1 To pin Step 1
            row = table.GetRow(oid)
            row.Value(table.FindField(fname)) = fvalue
            row.Store()
            n = n + 1
            oid = enumOID.Next
        Next

    End Sub

Please help me out of this.
Thank You,
Chaitanya

Outcomes