Forum: Object-Pascal / Delphi-Language
Delphi
by Flocke,
8. Dez 2005
Dann ist dein Code oben aber ziemlich `unsinnig´ (gelinde gesagt) 8)
Du willst also alle Zeilen aus "ListView1" löschen, die nicht in "y" stehen?
Das geht so:
for p := ListBox1.Items.Count - 1 downto 0 do
if y.IndexOf(ListBox1.Items) = -1 then
ListBox1.Items.Delete(p);
Forum: Object-Pascal / Delphi-Language
Delphi
by Flocke,
8. Dez 2005
Wenn ich deinen Code richtig `verstehe´ dann bezieht sich der Index "b" auf die Liste "y" und der Index "p" auf "ListView1.Items". Wieso prüfst du denn erst, ob "y.Strings" vorhanden ist, wenn du dann doch "ListView1.Items" löscht?
Forum: Object-Pascal / Delphi-Language
Delphi
by Flocke,
8. Dez 2005
Versuche es so:
for b := y.Count-1 downto 0 do
begin
p := listbox1.Items.IndexOf(y.Strings);
if p <> -1 then
ListBox1.Items.Delete(p);
end;