Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi String aus Ini soll ComboBox auf gleichen Item einstellen! (https://www.delphipraxis.net/58942-string-aus-ini-soll-combobox-auf-gleichen-item-einstellen.html)

Grolle 14. Dez 2005 22:26


String aus Ini soll ComboBox auf gleichen Item einstellen!
 
Hallo!
Ich will mit einem String eine ComboBox ansprechen. Der String ist in der ComboBox
identisch enthalten und diesen möchte ich jetzt anzeigen.

Viele Grüße...

Matze 14. Dez 2005 22:29

Re: String aus Ini soll ComboBox auf gleichen Item einstelle
 
Moin

Geht

Delphi-Quellcode:
ComboBox1.Text := 'blubb';
nicht?

Grolle 14. Dez 2005 22:34

Re: String aus Ini soll ComboBox auf gleichen Item einstelle
 
Hi!
Nein, das geht nicht. Die ComboBox ist auf csDropDownList eingestellt. Das
soll auch wenn möglich so bleiben.

Matze 14. Dez 2005 22:36

Re: String aus Ini soll ComboBox auf gleichen Item einstelle
 
Nicht sehr performant, aber wenn die Liste nicht zu lange ist, vernachlässigbar:

Delphi-Quellcode:
for i := 0 to ComboBox1.Items.Count - 1 do
begin
  if ComboBox1.Items[i] = 'blubb' then
  begin
    ComboBox1.ItemIndex := i;
    break;
  end;
end;
Nachtrag: :)
Delphi-Quellcode:
ComboBox1.ItemIndex := ComboBox1.Items.IndexOf('blubb');

Grolle 14. Dez 2005 22:43

Re: String aus Ini soll ComboBox auf gleichen Item einstelle
 
:wall: Da hätt ich auch selber drauf kommen können!
Funktioniert! Vielen Dank...


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:57 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