burabolin

Fire SelectionChanged event

Discussion created by burabolin on Apr 17, 2011
Latest reply on Apr 19, 2011 by burabolin
Hi, All

I am using VB.NET of ArcEngine 9.3.

Question is how I can fire OnSelectionChanged event when selecting feature.

My code is like below.

----------------------------------------
       Dim featLayer As IFeatureLayer
       featLayer = CreateLayerAndAddtoMap(pFC)

        If featLayer Is Nothing Then Exit Sub

        Dim featSel As IFeatureSelection = CType(featLayer, IFeatureSelection)

        Dim qFilter As IQueryFilter = New QueryFilter
        qFilter.WhereClause = pFilterStr

        Dim activeView As IActiveView = axmapcontrol.ActiveView
        activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection,Nothing,activeView.Extent)

        featSel.Clear()
        featSel.SelectFeatures(qFilter, esriSelectionResultEnum.esriSelectionResultNew, True)
        featSel.SelectionChanged()

        activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection,Nothing,activeView.Extent)
-----------------------------------
This code select feature well, but doesn't fire AxMapControl1.OnSelectionChanged event.
In debuging mode, after calling "featSel.SelectionChanged()", this doesn't go into the event sub routine.
I want to enable "Clear Selected Features Button" after selecting feature.
How can I fire SelectionChanged event?

Thanks in advance.

Outcomes