Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6691535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:45:47+00:00 2026-05-26T05:45:47+00:00

Var i : Integer; j : Integer; oSLArray : array of TStringList; oSL :

  • 0
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’m trying to make an array of TStringLists, read what’s coming from the RichEdit ‘EmailPassword’, and then print it (I will put it in an array when I get that far).

When I uncomment out oSLarray, I get an access violation.
When I tried it with oSL, nothing printed.

Now, I understand an access violation means the pointer may not be set properly, as I think the access violation is occurring at oSLArray[i] := TStringList.Create.

Am I just missing something small?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:45:47+00:00Added an answer on May 26, 2026 at 5:45 am

    I’ve corrected the code, I believe this code will work, but I’ve only tested it in my head.

    var 
      i : Integer; 
      j : Integer; 
      oSLArray : array of TStringList; 
      oSL : TStringList; 
    begin
      if not(Assigned(emailpassword)) then exit;
      SetLength(oSLArray, emailPassword.Lines.Count); 
      for i := 0 to emailPassword.Lines.Count - 1 do begin
        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] );   <<--- The error has here
        end; {for j} 
      end; {for i}
    
        //oSL := TStringList.Create; 
        //try
        //  oSL.Delimiter := ' '; 
        //  oSL.DelimitedText := emailPassword.Lines[i]; 
        //  for j := 0 to oSL.Count-1 do begin 
        //    Showmessage( oSL[j] ); 
        //  end; {for j}
        //finally
        //  oSL.Free;
        //end; {try}
        //end; {for i} 
    end;
    

    Here’s your old code with comments:

    for i := 0 to emailPassword.Lines.Count - 1 do //don't forget begin
      oSLArray[i] := TStringList.Create; 
      oSLArray[i].Delimiter := ' '; 
      oSLArray[i].DelimitedText := emailPassword.Lines[i]; 
    //<<<--  Here for i loop should end, but it does not.
        for j := 0 to oSLArray[i].Count-1 do begin 
     //You loop though all members of OSLArtray, even though only the first item is set, 
     //the rest is unassigned.
          Showmessage( oSLArray[i].Strings[j] );  <<-- Access Violation 
        end; } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here I provide simple piece of code. function GetStringList:TStringList; var i:integer; begin Result:=TStringList.Create; Result.Add('Adam');
In Delphi, consider var i: integer; begin for i := 0 to N do
What does (Sender:TObject) mean?? As in: procedure TForm1.Button1Click(Sender:TObject); var s: Integer; begin ..... .....
this code works fine: procedure TForm2.Timer1Timer(Sender: TObject); var Text: string; begin SetLength (Text,555); GetWindowText
I already read up about passing by reference and so procedure test(var x:integer); begin
I noticed by chance that the following code var I: Integer; begin I:= StrToInt('0xAA');
procedure TForm1.Timer2Timer(Sender: TObject); var ff : integer; begin for ff := 0 to 32
var i : integer; i := 1234567; Given the above, I want the string
I have an array of integers in string form: var arr = new string[]
I have four variables of type integer - var tip_1, tip_2, tip_3, tip_4; The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.