Hi!
I want to select a feature from a FeatureLayer using a query and I can't find any example of it.
The closest code snippet I have found uses somekind of selection by intersection, but that is not going to work for me:
Dim qf As QueryFilter = New QueryFilter()
qf.WhereClause = "Filed1= " & myVariable
Using rowCursor As RowCursor = fEdif.Search(qf)
While rowCursor.MoveNext()
Dim feature1 As Feature = TryCast(rowCursor.Current, Feature)
Dim geo As ArcGIS.Core.Geometry.Geometry = feature1.GetShape()
MapView.Active.SelectFeatures(geo)
End While
End Using
That way the building I want is selected, but also the ones that are attached to it.
So, how can I just select the feature that is returned by the search?
The FeatureLayer has a method called SetSelection, but I can't find any example of how to use it.
Thanks for any help provided!!
Hi Oscar,
You do not need any code snippet. Just use Select method from FeatureLayer. Like that:
featLayer.Select(qf); // your query filter