Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Werte in array speichern (https://www.delphipraxis.net/8467-werte-array-speichern.html)

Matze 5. Sep 2003 09:44


Werte in array speichern
 
Hi!

Sorry, dass ich nochmal störe, aber im Forum und in der OH habe ich nichts gefunden.

Ich möchte die Werte von einer ListBox in einem array speichern. Ich krieg's nicht hin.

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var a: array of real;
    i: integer;
begin
  for i:=0 to ListBox1.Count-1 do
  a[i]:=StrToFloat(ListBox1.Items[i]);
end;
Wie geht das richtig?

Tpercon 5. Sep 2003 09:47

Re: Werte in array speichern
 
War doch schon fast richtig. Nur irgendwie lernst du nicht dazu? Eben hatten wir doch SetLength und rate mal was jetzt fehlt?
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var a: array of real;
    i: integer;
begin
  SetLength(a,ListBox1.Count);
  for i:=0 to ListBox1.Count-1 do
  a[i]:=StrToFloat(ListBox1.Items[i]);
end;

Matze 5. Sep 2003 10:02

Re: Werte in array speichern
 
Oh Mann! :wall:

Danke!!

Christian S. 5. Sep 2003 10:04

Re: Werte in array speichern
 
Hallo, Matze!

Im Delphi-Forum habe ich ein kleines Tutorial über Arrays gepostet. Evtl. kannst Du etwas damit anfangen!

MfG
Peter


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:13 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz