Autor Beitrag
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Fr 09.04.04 12:36 
Hi.
Ich hab nur eine ganz kleine Frage.
ausblenden Delphi-Quelltext
1:
  Memo1.Lines.LoadFromFile('test.txt');					

Wie muss ich es machen wenn ich nur die 152 Zeile aus der test.txt in die memo laden will?

Moderiert von user profile iconMotzi: Topic Verschoben
TimonWorld
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 397



BeitragVerfasst: Fr 09.04.04 12:48 
Dieser Beitrag gehört eigentlich zu VCL!

Zu deiner Frage:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
begin
  label1.Caption:=memo1.Lines[152];
  memo1.Lines.Clear;
  memo1.Lines.Add(label1.Caption);
end;


Jetzt steht in deinem Memo nur noch Zeile 152!
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Fr 09.04.04 12:58 
Fast, es muss heißen:

ausblenden Delphi-Quelltext
1:
label1.caption := memo1.lines[151];					


weil der Index von 0 zu zählen beginnt. Also hat die 1. Zeile den Index 0.
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Fr 09.04.04 14:25 
außerdem ist es etwas dümmlich, ein Label als Speicherort zu benutzen. :roll:

ich denke,

ausblenden Delphi-Quelltext
1:
memo1.Text:= memo1.Lines[151];					


dürfte es auch tun, anderenfalls würde ich ein string-variable benutzen...

:D

Stefan

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)