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:
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)
For i = 0 To iOIDListCount - 1 pFeatureSelection.SelectionSet.Add(iOIDList(i)) Next i