Autor Beitrag
BoRn
Hält's aus hier
Beiträge: 3



BeitragVerfasst: So 14.07.02 12:06 
Hi Leute!
Ist sicherlich eine leichte Sache für euch.
Ich bin aber noch ein newbie in Delphi.
Aber jeder fängt ja mal klein an gell? ;-)

Ich habe eine ComboBox mit mehreren Einträgen und möchte, dass der erste Eintrag gleich standardmäßig ausgewählt ist.
Wie mache ich das?
Savage
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 110



BeitragVerfasst: So 14.07.02 12:14 
Hi,

du könnstest zB folgendes in OnCreate der Form mit einfügen:

ausblenden Quelltext
1:
2:
if combobox1.Items.Count >0 then
   combobox1.Text := combobox1.Items.Strings[0]


mfg
Savage
Viper
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 88



BeitragVerfasst: So 14.07.02 12:15 
Hallo,

das kannst du ganz einfach so machen:

ausblenden Quelltext
1:
ComboBox1.Text := ComboBox1.Items.Strings[0];					


Kurze Erklärung:
Unter Items stehen im Objektinspektor alle deine Einträge für die ComboBox und so kannst du zur Laufzeit darauf zugreifen!
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: So 14.07.02 12:16 
So sollte es funktionieren :-D
ausblenden Quelltext
1:
2:
If ComboBox1.Items.Count > 0 Then
  ComboBox1.ItemIndex := 0;
BoRn Threadstarter
Hält's aus hier
Beiträge: 3



BeitragVerfasst: So 14.07.02 12:27 
Jo, thx!
So gehts! :D