I have an array which length is set dynamically, it all works fine the first time the program is loaded. But if a user changes the settings and it needs to be resized it just gives and access violation.
procedure TForm1.MakeSignalArray();
var
SignalArray : array of integer;
b, integer;
begin
setlength(SignalArray,totaltime);
for b:=0 to length(SignalArray)-1 do
begin
SignalArray[t]:=0;
t:=t+1;
end;
end;
If I keep calling this procedure with no change to totaltime, then there is no error untill the program is closed where i get "Invalid pointer operation"
and when totaltime is changed i get an access violation..
any ideas what ive done wrong? thanks in advance
procedure TForm1.MakeSignalArray();
var
SignalArray : array of integer;
b, integer;
begin
setlength(SignalArray,totaltime);
for b:=0 to length(SignalArray)-1 do
begin
SignalArray[t]:=0;
t:=t+1;
end;
end;
If I keep calling this procedure with no change to totaltime, then there is no error untill the program is closed where i get "Invalid pointer operation"
and when totaltime is changed i get an access violation..
any ideas what ive done wrong? thanks in advance