Var
i : Integer;
j : Integer;
oSLArray : array of TStringList;
oSL : TStringList;
begin
SetLength(oSLArray, emailPassword.Lines.Count);
for i := 0 to emailPassword.Lines.Count - 1 do
{oSLArray[i] := TStringList.Create;
oSLArray[i].Delimiter := ' ';
oSLArray[i].DelimitedText := emailPassword.Lines[i];
for j := 0 to oSLArray[i].Count-1 do begin
Showmessage( oSLArray[i].Strings[j] );
end; }
oSL := TStringList.Create;
oSL.Delimiter := ' ';
oSL.DelimitedText := emailPassword.Lines[i];
for j := 0 to oSL.Count-1 do begin
Showmessage( oSL[j] );
end;
end;
I am trying to create an array of TStringLists, read that from RichEdit 'EmailPassword', and then print it (I will put it into the array when I get to this).
When I uncomment oSLarray, I get an access violation. When I tried it using oSL, nothing printed.
Now I understand that an access violation means that the pointer may be incorrectly set, since I think that the access violation occurs in oSLArray [i]: = TStringList.Create.
Did I just miss something small?
source
share