Autor Beitrag
Hendi48
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Mo 23.07.07 11:09 
Hi,
ich möchte gerne das mein Programm prüft (bevor es versucht etwas im eintrag zu verändern) ob ein Eintrag im ListView existiert weil man sonst eine access violation bekommt wenn man versucht ihn zu editieren (is ja klar wie soll man etwas verändern was es nicht gibt?) Geht das irgendwie?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 23.07.07 11:22 
Moin!

user profile iconHendi48 hat folgendes geschrieben:
ich möchte gerne das mein Programm prüft (bevor es versucht etwas im eintrag zu verändern) ob ein Eintrag im ListView existiert weil man sonst eine access violation bekommt wenn man versucht ihn zu editieren (is ja klar wie soll man etwas verändern was es nicht gibt?) Geht das irgendwie?

Ja. :D

Und wenn du noch dazu sagst, wie man diesen Eintrag finden soll oder woran man ihn erkennt, dann können wir vielleicht sogar sagen, wie... :roll:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Mo 23.07.07 12:02 
Also das is ne liste da sind Links drin und diese Links sollen halt bis auf den dateinamen abgekürzt werden. Nur es ist immer anders wieviele Links drin sind (mal 1, mal 45, mal 90). Und das Programm soll halt wenn der Eintrag leer ist (=kein Link) aufhören (weil sons av). Die ListView hat den Style vsReport und ist in 4 Spalten eingeteilt (ich will immer die erste verändern, welche die Hauptspalte ist, also muss auch in der Hauptspalte geprüft werden ob sie leer ist.). Jetzt verständlicher?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 23.07.07 12:07 
Moin!

Du willst also nur wissen, ob überhaupt was im ListView drin ist, richtig? Probier mal: ;)
ausblenden Delphi-Quelltext
1:
2:
if (ListView1.Items.Count > 0) then
  ShowMessage('Das ListView enthält Elemente.');

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Mo 23.07.07 12:12 
Nein, ich hab das so:
ausblenden Delphi-Quelltext
1:
2:
  LinkKuerzen(0); // die zahl is immer der ListView Eintrag
  LinkKuerzen(1); // was wenn die 2. Zeile nicht existiert

Also müsste immer vor dem Kürzen geprüft werden ob die Zeile auch nicht leer ist
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 23.07.07 12:42 
Moin!
ausblenden Delphi-Quelltext
1:
2:
for i := 0 to ListView1.Items.Count-1 do
  LinkKuerzen(i);
:|
cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Mo 23.07.07 12:49 
Ja! Genau das habe ich gesucht! Danke