Solved

All Memo Text in one Line

Posted on 2003-11-08
4
210 Views
Last Modified: 2010-04-05
Hi.
I have a memo with some lines , like this :

Name : Richard Jakson
Age : 35
Adress : 5th Avenue

and i want like this

Name : Richard Jakson Age : 35 Adress : 5th Avenue

can someone help me ??? thnx a lot
0
Comment
Question by:fuscao_sp
4 Comments
 
LVL 5

Expert Comment

by:arjanh
ID: 9706982
var
  res : String;
  i : Integer;
begin
  res := '';
  for i := 0 to memo.lines.count - 1 do
    res := res + memo.lines[i];
end;
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 45 total points
ID: 9707038
or

procedure TForm1.Button1Click(Sender: TObject);
begin
  memo1.Text := stringReplace(memo1.text,#13#10,' ',[rfReplaceAll]);
end;

meikl ;-)
0
 
LVL 1

Expert Comment

by:JackNaif
ID: 9707262
Both those solutions will most likely work.
Both will alter the contents of your memo to be in one line.

But if memo1.wordwrap is true, you will see it on screen as many lines unless your memo1.width is big enough to fit the whole lenght of the text. If you set it to false, then the text will go beyond the edge and you will have to scroll.

However if you want to process the text in your memo  as a single line while showing it on the screen as many lines, then you should make use of memo1.text. It has all the text in one single string. It's good for many applications such as storing it in a file where you already have other contents. (If you want to put only the contents of a single TMemo in a file, you use memo1.lines.SaveToFile, and then memo1.lines.LoadFromFile to get it back).

Hope it helps:

Jack
0
 
LVL 5

Expert Comment

by:DeerBear
ID: 9714284
Hi,

Use Memo1.Lines.Text .

Cheers,

Andrew
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now