Code Modification Needed Strings

Hi all,

I'm trying to use the following code but I don't want to have to loadfromfile and then save...I want to load from memo and then copy back to memo instread but I'm getting:

error: [DCC Error] Unit1.pas(809): E2010 Incompatible types: 'TStrings' and 'string' when I try to change the code to read from a memo

Here is the code below...

thx


procedure TForm1.ToolButton2Click(Sender: TObject);
var  listHtml:      TStringList;
     st, et:        LongWord;
begin

    st:=GetTickCount;
  listHtml:=TStringList.Create;
  try
     listHtml.LoadFromFile('c:\google.txt');
     ConvertHtml(listHtml, 'http://www.google.com');
     listHtml.SaveToFile('c:\google.html');
  finally
     listHtml.Free;
  end;
  et:=GetTickCount-st;
  ShowMessage(IntToStr(et));

 
end;

Open in new window

ST3VOAsked:
Who is Participating?
 
SteveBayCommented:
IT's not clear from your code exactly what your problem is.
but have you tried something like this?


listHtml.Assign(Memo.Lines);
ConvertHtml(listHtml, 'http://www.google.com'); 
Memo.Lines.Assign(listHtml);

Open in new window

0
 
ST3VOAuthor Commented:
Perfect! That worked :o)  Thanks!!!
0
 
twinsoftCommented:
Hi, why don't you use the text property of TStringList ?

memo.lines.text := listHtml.text;

and vice versa...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.