Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Code Modification Needed Strings

Posted on 2010-01-04
3
Medium Priority
?
254 Views
Last Modified: 2012-05-08
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

0
Comment
Question by:ST3VO
3 Comments
 
LVL 14

Accepted Solution

by:
SteveBay earned 2000 total points
ID: 26175188
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
 

Author Closing Comment

by:ST3VO
ID: 31672626
Perfect! That worked :o)  Thanks!!!
0
 
LVL 7

Expert Comment

by:twinsoft
ID: 26176255
Hi, why don't you use the text property of TStringList ?

memo.lines.text := listHtml.text;

and vice versa...
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This is an update to some code that someone else posted on Experts Exchange. It is an alternate approach, I think a little easier to use, & makes sure that things like the Task Bar will update.
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question