Take the 2-minute tour ×

Is there a way to update the Editor Attributes dialog to populate/refresh on ArcObject feature selection code? The attributes dialog only seems to respond to a manual view selection or manual table selection. Here is my current feature selection code:


            Dim pFeatSelection As IFeatureSelection = Nothing
            Dim pFeatureLayer As IFeatureLayer
            Dim pQueryFilter As IQueryFilter
            Dim pSelSet As ISelectionSet
            Dim pFCur As IFeatureCursor = Nothing
            Dim player As ILayer
            Dim pEnumLayer As IEnumLayer

            m_App = CType(Hook, IApplication)
            m_MxDoc = CType(m_App.Document, IMxDocument)
            m_mxDocument = CType(m_App.Document, MxDocument)
            m_map = CType(m_MxDoc.FocusMap, Map)

            Dim pActiveView As IActiveView
            pActiveView = m_MxDoc.FocusMap

            m_map = m_MxDoc.ActiveView.FocusMap
            pEnumLayer = m_map.Layers

            Dim number As Int32 = InputBox("FID number")

            player = pEnumLayer.Next
            Do Until player Is Nothing
                If player.Name = "MyLayer" Then
                    pFeatureLayer = CType(player, IFeatureLayer)
                    pFeatSelection = CType(pFeatureLayer, IFeatureSelection)
                End If
                player = pEnumLayer.Next

            pQueryFilter = New QueryFilter
            pQueryFilter.WhereClause = "FID = " & number

            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing)

            pFeatSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, False)
            ' Create a feature cursor of selected interstates.
            pSelSet = pFeatSelection.SelectionSet
            pSelSet.Search(Nothing, False, pFCur)
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing)

        Catch ex As Exception
            MessageBox.Show("Caught an unspecified error in the calling code: " & vbCrLf & ex.ToString)

Thank You

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Make sure you call IFeatureSelection.SelectionChanged on every layer you update the selection of.

Also, while not needed in every case, once the layer selection is updated for all desired layers, you should cast the Map to ISelectionEvents and call ISelectionEvents.SelectionChanged as well.

share|improve this answer
That was it, thank you! –  artwork21 Dec 16 '11 at 1:52

Your Answer


