Solved

setting text property in dropdown list combo box

Posted on 2001-08-15
4
352 Views
Last Modified: 2010-04-06
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?????

0
Comment
Question by:aussie_guy_nik
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
Slavak earned 50 total points
ID: 6389258
cmbFields.ItemIndex := 0;
0
 
LVL 4

Expert Comment

by:YodaMage
ID: 6389451
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.
0
 
LVL 4

Expert Comment

by:YodaMage
ID: 6389452
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.
0
 
LVL 3

Expert Comment

by:nnbbb09
ID: 6389617

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
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question