Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

About Memo component

Posted on 1999-01-07
10
Medium Priority
?
248 Views
Last Modified: 2012-05-04
How can I make program which write 10 or more text lines in Memo component (I want to use command FOR...TO...DO)

Thank you for your time!
0
Comment
Question by:mmilan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1355132
Hi mmilan,

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var i :integer;
begin
 for i:= 1 to 10 do begin
  memo1.lines.Add('this is line '+IntToStr(i));
 end;
end;

end.


Regards, Zif.
0
 

Author Comment

by:mmilan
ID: 1355133
It do NOT work!
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1355134
??? It did not work?

Open a new application :

put a button on your form
put a memo on your form

replace the unit code with this code I gave you

assign the clickevent of the button to buttonclick

Regards, Zif

Please, specify the errors you get


0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Expert Comment

by:ZifNab
ID: 1355135
here is another example:

just open a new application and replace unit code by this one :

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    memo : TMemo;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
var i : integer;
begin
 memo := TMemo.Create(Form1);
 memo.Parent := Form1;
 for i := 1 to 10 do begin
  memo.lines.add('this is line '+IntToStr(i));
 end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
 memo.free;
end;

end.

Zif.
0
 
LVL 1

Expert Comment

by:Oli2
ID: 1355136
Hehehe, Zif !
Seems to me, you get your grading here: it did NOT work....  :-))
Now how to handle this for.. to..do problem ??
Need Help ? ;-))

Greetings, Oli
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1355137
? Oli, sarcasm? It should work, because I tried it out.. and it worked...
0
 

Expert Comment

by:theraphy
ID: 1355138
what is wrong with zifnab's answer? it works...
0
 

Author Comment

by:mmilan
ID: 1355139
How to give him points? It's Ok now!
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 80 total points
ID: 1355140
Hi mmilan,

I just answer it again.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var i :integer;
begin
 for i:= 1 to 10 do begin
  memo1.lines.Add('this is line '+IntToStr(i));
 end;
end;

end.

Regards, Zif.
0
 

Author Comment

by:mmilan
ID: 1355141
It's Ok!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

650 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