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

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

Combobox

In a dropdown combobox I have 3 values (TStrings).How do I make one appear by default when the form gets displayed i.e combobox???
0
Sendo
Asked:
Sendo
  • 2
1 Solution
 
simonetCommented:
In the form's OnCreate or OnShow event, add this line:

ComboBox1.itemindex := 1; { or whatever is the itemindex # of the item you want as default }

Yours,

Alex
0
 
SendoAuthor Commented:
Are you sure there is no another way?
Just asking ....
0
 
simonetCommented:
Yes, Sendo, I am sure. Unless you're willing to create a component that's a derivative from TCustomComboBox, and add an ItemIndex property to it, but that's even more trouble and hassle than what I've already suggested.

Yours,

Alex
0
 
DrDelphiCommented:
I would have to disagree, but it is really only a techinicality. You can set the ComboBox's TEXT property to read anything you like without it having to be an item in it's strings property.

0

Featured Post

Technology Partners: 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