What is the Process to find the inverse of selected data from featureclass using vb.net arcobject?
closed as unclear what you're asking by Mapperz♦ Jun 18 '14 at 20:29
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
The following VBA code shows you how to inverse the current selection on a layer, you would then get a SelectionSet on it to step through the new selection.
Public Sub InverseSelection() ' Get Document Dim pMXdocument As IMxDocument Set pMXdocument = ThisDocument ' Get Map Dim pMap As IMap Set pMap = pMXdocument.FocusMap ' Get first layer in TOC Dim pLayer As ILayer Set pLayer = pMap.Layer(0) ' QI into IFeatureLayer Dim pFeatureLayer As IFeatureLayer Set pFeatureLayer = pLayer ' Get feature selection Dim pFeatureSelection As IFeatureSelection Set pFeatureSelection = pFeatureLayer ' Inverse the selection pFeatureSelection.SelectFeatures Nothing, esriSelectionResultXOR, False pMXdocument.ActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing End Sub
I don't think it's possible to call the switch selection option that is available in ArcGIS using ArcObjects.
A workaround might be to use ISelectionSet.Combine
Get a selection set of the records you want using iFeatureClass.Select, then get a second selection set of all records in the featureclass using iFeatureClass.Select (by passing 'nothing' as the query filter). Use the Combine method on this second selection set using the ESRISetOperation "difference" and that should give you all of the records which are not part of the first selection set.