Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi listview spalte (https://www.delphipraxis.net/6668-listview-spalte.html)

aTriX 17. Jul 2003 22:20


listview spalte
 
Hi


ich hab ein listview mit 2 Spalten [ ID ] [Zahl]
jetzt will ich zb. spalte [zahl] Komplett auslesen und alle zahlen zusammenrechen und sie in ein label setzten, wie wäre das möglich


cYa
aTriX

Christian Seehase 17. Jul 2003 22:23

Re: listview spalte
 
Moin Atrix,

erst einmal herzlich willkommen in der Delphi-PRAXiS.

Geh' doch einfach in einer For Schleife durch alle ListViewItems, und lies dabei SubItems[0] aus.
Die Caption eines LV Items ist, i.d.R., immer die erste Spalte, die folgenden sind dann SubItems[0] bis SubItems[n].

aTriX 18. Jul 2003 04:28

Re: listview spalte
 
sers

ich möchte hier nicht unverschämt oder so klingen, aber könntest du vielleicht einen bsp. code posten? hab allgemein mit Delphi nix zutun mehr mit directx

cya atrix

MathiasSimmack 18. Jul 2003 07:41

Re: listview spalte
 
Wie unverschämt. :mrgreen:
Delphi-Quellcode:
iErgebnis := 0;

with ListView1.Items do
  for i := 0 to Count - 1 do
    inc(iErgebnis,StrToIntDef(Item[i].SubItems[0],0));
"i" und "iErgebnis" sind integer-Variablen.

aTriX 20. Jul 2003 01:57

Re: listview spalte
 
hi


hmmm... mir gings eigendlich mehr um die berechnung als die schleife

cYa

aTriX

Hansa 20. Jul 2003 02:03

Re: listview spalte
 
wenn ich das alles richtig sehe brauchst Du doch nur iErgebnis hochzuzählen, also
Code:
iErgebnis := iErgebnis + StrToIntDef(Item[i].SubItems[0],0));;

Christian Seehase 20. Jul 2003 02:13

Re: listview spalte
 
Moin Hansa,

das hat Mathias doch auch schon geschrieben ;-)
Er macht's nur mit inc(...).

Hansa 20. Jul 2003 02:21

Re: listview spalte
 
inc ist manchmal zuviel verlangt. :mrgreen:


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:35 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