![]() |
List index out of (50)
Hallo,
ich habe da mal ein kleines Problem. Und zwar geht es um folgenden kleinen Code-Ausschnitt: for i:=50 downto 1 do begin zeile := tabelle[i]; end; Von i:= 1 bis 49 gibt es keine Probleme, aber ab 50 erhalte ich jedes mal die Fehlermeldung: "List index out of (50)" Achso, tabelle ist übriges vom Typ TStringList, hängt das irgendwie damit zusammen? Danke schon mal für die Hilfe! ;) |
Re: List index out of (50)
Wie sieht den die Stringliste aus?
Wieviele Einträge hat sie? Wenn Du 50 Einträge in der Stringlist hast, musst Du von 0 bis 49 bzw. von 49 bis 0 zählen, um alle Einträge zu bekommen. |
Re: List index out of (50)
Mach es besser so:
Delphi-Quellcode:
for i:=tabelle.Count - 1 downto 0 do
begin zeile := tabelle[i]; end; |
Re: List index out of (50)
Mach es gleich so:
Delphi-Quellcode:
Kommt in dem Fall aufs gleiche raus. :zwinker:
zeile := tabelle[0];
|
Re: List index out of (50)
Stimmt. Ich habe das Count - 1 vergessen. :wall:
Jetzt scheint es zu funktionieren! :) Vielen Dank! ;) |
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:21 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz