This is a fragment of a class that removes repeated values in fArr.
procedure tArray.removedup;
var
K,R : word;
DArray : array of string;
begin
SetLength(DArray, max);
for K := 1 to max do
if fArr[K] <> '' then
begin
fCount := fCount + 1;
DArray[K - 1] := fArr[K];
end;//if
SetLength(DArray, fCount);
K := 1;
while K < fCount do
begin
for R := K+1 to fCount do
if DArray[K] = DArray[R] then
begin
finalize(DArray[R]);
if fCount - R > 0 then
Move(fArr[R + 1], DArray[R], SizeOf(string) * (fCount - R));
Initialize(DArray[fCount - 1]);
SetLength(DArray, fCount);
end; //if
K := K + 1;
end;//while
for K := 1 to fCount do
fArr[K] := DArray[K-1];
end;
I know it looks messy... but the problem is actually at the last for loop. The program bombs out saying "Invalid pointer operation"