Hello all,
I use VBA in ArcMap 9.3.1:
- I have a polygon-layer (in SDE-GeoDatabase) loaded
- the editor is started and the target is the polygon-layer
I run the code below (Map.ClearSelection and then a Attribute-Selection). One polygon is now selected.
Then I use the "Edit Tool" from the Editor-Toolbar and I try to move the polygon. The polygon keeps on his place and I get a message "The feature(s) could not be moved. The coordinates or measures are out of bounds."
When I close this message-box and I try to move the feature again, it moves correctly.
When I comment out the line "pMap.ClearSelection" and run the code, the polygon moves at first attempt without any error-message.
What's wrong ?
harpo
Code:
Public Sub SelFeatures()
Dim pMxDoc As IMxDocument
Dim pMap As IMap
Dim pFeatSel As IFeatureSelection
Dim pQF As IQueryFilter
Dim pSelSet As ISelectionSet
Set pMxDoc = Application.Document
Set pMap = pMxDoc.FocusMap
pMap.ClearSelection
Set pFeatSel = pMap.Layer(0)
Set pQF = New QueryFilter
pQF.WhereClause = "OBJECTID = 1"
pFeatSel.SelectFeatures pQF, esriSelectionResultNew, False
pFeatSel.SelectionChanged
pMxDoc.ActiveView.Refresh
Set pSelSet = pFeatSel.SelectionSet
Debug.Print pSelSet.Count
End Sub