AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

ComboBox: keine doppelten Einträge

Ein Thema von yankee · begonnen am 7. Mai 2004 · letzter Beitrag vom 7. Mai 2004
Antwort Antwort
Benutzerbild von yankee
yankee

Registriert seit: 10. Mär 2004
1.134 Beiträge
 
Lazarus
 
#1

ComboBox: keine doppelten Einträge

  Alt 7. Mai 2004, 19:22
Ich will aus einer ComboBox (mit sorted=True) alle doppelten Einmträge entfernen. Das sieht dann soi aus:

Delphi-Quellcode:
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;
Funzt aber nicht. Was ist falsch?
Letzter Tipp: Drogen. Machen zwar nicht glücklich, geben einem aber wenigstens das Gefühl glücklich zu sein.

Have a lot of fun!
  Mit Zitat antworten Zitat
Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#2

Re: ComboBox: keine doppelten Einträge

  Alt 7. Mai 2004, 19:28
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;
Thomas
  Mit Zitat antworten Zitat
Markus K.

Registriert seit: 26. Jan 2004
Ort: Halle
346 Beiträge
 
Delphi 2005 Personal
 
#3

Re: ComboBox: keine doppelten Einträge

  Alt 7. Mai 2004, 19:29
Hallo yankee,
versuche es mal so.
Delphi-Quellcode:
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;
Tschüß Markus
  Mit Zitat antworten Zitat
Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#4

Re: ComboBox: keine doppelten Einträge

  Alt 7. Mai 2004, 19:32
Musst noch eine DownTo-Schleife nehmen!
Thomas
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 09: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