delphi comboBox

15,132

Solution 1

You find the selected item with:

combobox.ItemIndex; // -1 if none

You can get the value using

combobox.Items[combobox.ItemIndex]

Solution 2

combobox.text will hold the value which was selected

Share:
15,132
none
Author by

none

Updated on June 04, 2022

Comments

  • none
    none almost 2 years

    how does one get the picked value of a combo box from delphi 7

    lets say it has items, how does one know which row (item) was picked?

  • David Heffernan
    David Heffernan over 13 years
    obviously you get an error if you write combobox.Items[combobox.ItemIndex] without checking that combobox.ItemIndex<>-1 first
  • Toby Allen
    Toby Allen over 13 years
    One issue here however is if the combobox allows editing the text may not match any of the items, which is worth noting.
  • Haywood Chablowme
    Haywood Chablowme almost 7 years
    since i have no enough points to comment previous answer i needed to put it as separate answer. Toby's comment actually warns about same thing.