Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi ComboBox Item-Zahl (https://www.delphipraxis.net/7150-combobox-item-zahl.html)

Micha 4. Aug 2003 07:42


ComboBox Item-Zahl
 
Ich hab mal wieder eine kurze Frage:

Ich habe eine ComboBox mit über 100 Einträgen.
Jetzt will ich die Nummer des Eintrages in einem EditFeld ausgeben.

Nachdem es ja über 100 Einträge sind, wird mir der untenstehende Quellcode zu lang.
Das geht doch bestimmt auch einfach oder?

Delphi-Quellcode:
  begin
   if ComboBox1.ItemIndex = 0 then
  begin
   Edit1.Text := '1';
  end;
  if ComboBox1.ItemIndex = 1 then
  begin
   Edit1.Text := '2';
  end;
  ...

JoelH 4. Aug 2003 07:47

Re: ComboBox Item-Zahl
 
Delphi-Quellcode:
Edit1.Text := IntToStr(combobox1.itemIndex);

Micha 4. Aug 2003 07:55

Re: ComboBox Item-Zahl
 
Optimal.

DANKE.


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:39 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-2025 by Thomas Breitkreuz