N
N
Nekit Medvedev2017-05-26 06:29:03
Delphi
Nekit Medvedev, 2017-05-26 06:29:03

How to write in Richedit a Character from a two-dimensional array?

procedure TForm4.Button1Click(Sender: TObject);
 var
c:array of array of char;
s:char;
i,j,p,x: integer;
begin
p:=RichEdit1.Lines.Count;
setlength(c,0,0);
setlength(c,p,100);

  for i := 0 to RichEdit1.Lines.Count - 1 do
    for j := 1 to Length(richedit1.Lines[i]) do
      c[i][j] := RichEdit1.Lines[i][j];

  for i := 0 to RichEdit2.Lines.Count -1 do
    for j := 1 to Length(RichEdit2.Lines[i]) do
    begin
    s:= c[i, j];
    RichEdit2.Lines[i][j]:=s;
    end;
end;

end.

I'm currently using this code, it throws an error:
[dcc32 Error] Unit4.pas(46): E2064 Left side cannot be assigned to

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kalapanga, 2017-05-26
@kalapanga

In addition to what you have already written, there are more logical nuances. Obviously, before pressing the button, you entered some text in RichEdit1. And what do you have in RichEdit2 at this time? And if there are no lines at all and RichEdit2.Lines.Count is 0, what should happen? For some cases, your solution may work, but not always.
And by the way, if you need to completely replace the content of RichEdit2 with the content of RichEdit1, then you only need one statement: RichEdit2.Lines.Assign(RichEdit1.Lines);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question