AnsweredAssumed Answered

Table operation only for selected features??

Question asked by r2d2_25 on Apr 18, 2011
Latest reply on Apr 20, 2011 by kenbuja
Hello everybody,

I wrote a code to fill in some information in a table. My problem is, that even if I have selected some features, the operations works on every row in the table and not only on the selected ones!
I don't know how to do that.
I think something with ISelection but does somebody know? Here is my code:
(ArcGIS 10 VB.NET)

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Try
            Dim pMxDoc As IMxDocument
            Dim pLayer As ILayer
            Dim pFLayer As IFeatureLayer
            Dim pFeatClass As IFeatureClass
            Dim pMap As IMap
            Dim pCursor As ICursor
            Dim pCalculator As ICalculator
            Dim BOXText1 As String
            Dim Quatsch As ISelection
            Dim pPageLayout As IPageLayout
            Dim pViewManager As IViewManager


            pMxDoc = My.ArcMap.Document
            pMap = pMxDoc.FocusMap
            pLayer = pMxDoc.SelectedLayer
            If pLayer Is Nothing Then
                MessageBox.Show("Achtung, es ist kein Layer selektiert", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
                Exit Sub
            End If
            pFLayer = pLayer
            pFeatClass = pFLayer.FeatureClass
            pCursor = pFeatClass.Update(Nothing, True)
            BOXText1 = ComboBox1.Text
            pCalculator = New Calculator
            With pCalculator
                .Cursor = pCursor
                .Expression = BOXText1
                .Field = "PROJECT"
            End With

            pCalculator.Calculate()
            MessageBox.Show(" Die Spalte PROJECT wurde mit dem Eintrag '" & BOXText1 & "' gefüllt!")

        Catch ex As Exception
        End Try
    End Sub


Would be nice to get some help! :)
Thanks and Greetings
Denise

Outcomes