Autor Beitrag
Delphi2009lover
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 176



BeitragVerfasst: Fr 25.09.09 18:07 
Hallo erstmal,

ich habe eine TXT mit ein paar Namen

ausblenden Quelltext
1:
2:
3:
4:
5:
Name 1
Name 2
Name 3
Name 4
Name 5


usw jetzt will ich die Anzahl der Zeilen dieser TXT auslesen (in dem Fall 5) gibt es dafür eine Funktion bzw wie muss ich da vorgehen?


Danke schon mal im Vorraus
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Fr 25.09.09 18:16 
mit TMemo.loadfromfile laden und mit TMemo.lines.count auslesen
Delphi2009lover Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 176



BeitragVerfasst: Fr 25.09.09 18:23 
ok gute idee^^ thx
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 25.09.09 18:38 
Aber bitte nicht eine (unsichtbare) Memo dafür nehmen, sondern eine Stringlist. ;-)

_________________
We are, we were and will not be.
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Sa 26.09.09 10:31 
:oops: :roll: :oops: :oops:
Das ist natürlich richtig...
anbest
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 17

Win XP Prof. SP 3
Delphi 2006 Arch.
BeitragVerfasst: So 27.09.09 14:13 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
const
  sFile = 'C:\Meine Datei.txt';
var
  slFile: TStringList;
  iCount: Integer;
begin
  slFile := TStringList.Create;
  try
    slFile.LoadFromFile(sFile);
    iCount := slFile.Count;
  finally
    slFile.Free;
  end;

  ShowMessageFmt('Die Datei "%s" hat %d Zeilen.', [sFile, iCount]);
end;
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 27.09.09 14:51 
Ich bin mir ziemlich sicher, dass er das auch noch ohne Beispiel hinbekommen hätte. ;)