![]() |
ComboBox: keine doppelten Einträge
Ich will aus einer ComboBox (mit sorted=True) alle doppelten Einmträge entfernen. Das sieht dann soi aus:
Delphi-Quellcode:
Funzt aber nicht. Was ist falsch?
for i :=1 to VerlagcomboBox.Items.Count do
begin if VerlagcomboBox.Items.Names[i] =VerlagcomboBox.Items.Names[i+1] then VerlagComboBox.Items.Delete(i); end; |
Re: ComboBox: keine doppelten Einträge
Hi,
Hier eine andere Variante:
Delphi-Quellcode:
var
sl: TStringList; begin sl := TStringList.Create; try with sl do begin sl.Sorted := True; Duplicates := dupIgnore; Assign(ComboBox1.Items); end; ComboBox1.Items.Assign(sl); finally sl.Free; end; |
Re: ComboBox: keine doppelten Einträge
Hallo yankee,
versuche es mal so.
Delphi-Quellcode:
Tschüß Markus
for i :=0 to VerlagcomboBox.Items.Count-1 do
begin if VerlagcomboBox.Items.Names[i] =VerlagcomboBox.Items.Names[i+1] then VerlagComboBox.Items.Delete(i); end; |
Re: ComboBox: keine doppelten Einträge
Musst noch eine DownTo-Schleife nehmen!
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:20 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