I am making a selection with ArcObjects, is there an Issue with iSelectionSet:AddList

المشرف العام

Administrator
طاقم الإدارة
I collect a set of OIDs into an OID array (long), this happens in a loop and if i find an OID i want to add to the array, I REDIM PRESERVE to expand the array.

iOIDListCount = iOIDListCount + 1 ReDim Preserve iOIDList(iOIDListCount) iOIDList(iOIDListCount - 1) = pRow.OID Debug.Print(iOIDList(iOIDListCount - 1)) Once I use this array to make my selelction via iFeatureSelection.SelectionSet.AddList there is no error but a the resulting selection is completely wrong. Instead of getting an expected 89 records the attribute table is reporting 40 is selected but only about 10 records is physically selected on screen and in the attribute table (see figure 1)

NOT WORKING CORRECTLY:

pFeatureSelection.SelectionSet.AddList(iOIDListCount, iOIDList(0)) However when I use a For Next loop instead and add the OID's individually, I get exactly what I expect: 89 records. (see figure 2)

WORKS FINE:

For i = 0 To iOIDListCount - 1 pFeatureSelection.SelectionSet.Add(iOIDList(i)) Next i Figure 1 - Incorrect selection result when using AddList approach

Figure 2 - COrrect selection result when using Add (individually in a loop) approach



أكثر...
 
أعلى