Hola albelg, bienvenido a Club Delphi
Como acostumbramos con los que se inician, te invitamos a que leas nuestra
guía de estilo.
Revisa este ejemplo:
Código Delphi
[-]
...
implementation
procedure TForm1.FormCreate(Sender: TObject);
begin
OpenDialog1.Filter := 'Archivos de texto|*.TXT'
with Memo1 do
begin
Lines.Clear;
ScrollBars := ssVertical;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
ts: TStrings;
begin
if OpenDialog1.Execute then
begin
ts := TStringList.Create;
try
ts.LoadFromFile(OpenDialog1.FileName);
Memo1.Lines.AddStrings(ts);
Memo1.SelStart := Length(Memo1.Text);
Memo1.SelLength := 0;
Memo1.SetFocus;
finally
ts.Free;
end;
end;
end;
Saludos