Bonjour à tous
Je cherche comment faire pour supprimer les doublons dans une combobox
j'ai trouvé ce script
mais je ne sais pas comment l'appliquer
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 procedure SupprimerDoublons(Strings : TStrings; CaseSensitive : boolean = True); var SL : THashedStringList; begin SL := THashedStringList.Create; try SL.Duplicates := dupIgnore; SL.CaseSensitive := CaseSensitive; SL.Sorted := True; // Sinon Duplicates ne fait rien ! SL.Capacity := Strings.Capacity;// Allocation du tableau une fois pour toutes SL.AddStrings(Strings); Strings.BeginUpdate(); try Strings.Clear(); Strings.Capacity := SL.Capacity;// Allocation du tableau Strings.AddStrings(SL); finally Strings.EndUpdate(); end; SL.Free; end; end;
A savoir que je rempli ma combobox par une boucle dans l'afterpost .
si quelqu'un à une autre solution à me proposer ou m'expliquer un peu comment et ou appliquer cette procédure.
Merci d'avance.
Partager