# Best way to find/set a ComboBox value?

**URL:** <https://forum.kirupa.com/t/best-way-to-find-set-a-combobox-value/291962>\
**Category:** flash\
**Created:** [July 8, 2009, 10:52am UTC](https://forum.kirupa.com/t/best-way-to-find-set-a-combobox-value/291962 "2009-07-08T10:52:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dub2k](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@dub2k](https://forum.kirupa.com/u/dub2k)\
**Post date:** [July 8, 2009, 10:52am UTC](https://forum.kirupa.com/t/best-way-to-find-set-a-combobox-value/291962/1 "2009-07-08T10:52:37Z")

</div>

I’m creating an Air app, but I think this is more of a general AS3 question (I’m using Flash CS4).

I have 3 ComboBoxes ( They are created in the IDE not using code. ):

one for day (cb\_date, dataprovider of {label:“1”,data:1} -\> {label:“31”,data:31})  
one for month(cb\_month, dataprovider of {label:“January”,data:1} -\> {label:“December”,data:12})  
one for year(cb\_year, dataprovider of {label:“2007”,data:2007} -\> {label:“2009”,data:2009}).

I’ve got the information for yesterday (when I need to set the date in the 3 boxes) in a Date object, I know that you can set selectedItem/selectedIndex of the comboboxes to set the right selection, but finding which one it matches is proving to be difficult ☹

```auto
var tmpDP:DataProvider = cb_date.dataProvider;            
trace(tmpDP.length);

```

The above returns 0 if i run it in the constructor for the page class, and I cant seem to spot anything else in the verbose documentation for it that will give me a list or length of items so I can loop thu until I find what I’m looking for.

While in this case I can hardcode the lengths, but as I’m learning AS3 (I have 10+ years of flash experience), I wouldnt mind knowing how to do this because I’m not always going to be able to hardcode them.
