Solved

About Memo component

Posted on 1999-01-07
10
236 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
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
 
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
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.

 
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 20 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

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

867 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

24 Experts available now in Live!

Get 1:1 Help Now