Solved

About Memo component

Posted on 1999-01-07
10
235 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 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

20 Experts available now in Live!

Get 1:1 Help Now