Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

Combobox Style : dropdownlist

thanks all experts for your help

I am using combobox with style csdropdownlist
and i need to show the text of the combobox
I had an answer that i can use combobox1.itemindex=the number of the item i want to show.
that's fine but what if the item i want to show is already chosen and i am getting it from a dataset and afcourse it matches with the item in the combobox
so i cann't use  combobox1.itemindex=the number of the item i want to show.
i need for example : combobox1:=datamodule1.table2['fieldname']

regards
0
ibrobar
Asked:
ibrobar
  • 2
1 Solution
 
mokuleCommented:
ComboBox1.ItemIndex := ComboBox1.Items.IndexOf(datamodule1.table2['fieldname'].asstring);
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
use indexof to find the index of the desired item
combobox1.itemindex := Combobox1.indexof(datamodule1.table2['fieldname]); //as your example....

0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
too late and also wrong :((
combobox1.items.indexof....
i need some relax :))
0
 
shaneholmesCommented:
In your previous post, it was already stated ....


ComboBox1.ItemIndex := ComboBox1.Items.IndexOf(Some String of your's here);

which is the same thing

as

ComboBox1.ItemIndex := ComboBox1.Items.IndexOf(datamodule1.table2['fieldname'].asstring);

you just had to replace the string, which was
datamodule1.table2['fieldname'].asstring

Shane
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now