Link to home
Start Free TrialLog in
Avatar of aussie_guy_nik
aussie_guy_nik

asked on

setting text property in dropdown list combo box

How do I set text in a "dropdown list" style combo box.

I know how to set it in the normal "dropdown" style combo box. eg.  
                   cmbFields.Text := cmbFields.Items[0];

However, when I do this in the "dropdown list" style combo box, it won't work?????

ASKER CERTIFIED SOLUTION
Avatar of Slavak
Slavak

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of YodaMage
YodaMage

This gets more complicated if you are using data aware components. If so, you can set tdbcombobox.itemindex := n;, but once you open/activate the data set, you are going to have a changed result based on field.value. You may have to handle <null> or other field values in the afterscroll event.
This gets more complicated if you are using data aware components. If so, you can set tdbcombobox.itemindex := n;, but once you open/activate the data set, you are going to have a changed result based on field.value. You may have to handle <null> or other field values in the afterscroll event.

Assuming that the text that you want to set is present in the combobox items property you can use :

cmbFields.ItemIndex := cmbFields.Items.IndexOf('some text');

Jo