# setSelectedIndex(Label)

**URL:** <https://forum.kirupa.com/t/setselectedindex-label/24920>\
**Category:** flash\
**Created:** [July 7, 2003, 7:37am UTC](https://forum.kirupa.com/t/setselectedindex-label/24920 "2003-07-07T07:37:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![waffe](https://avatars.discourse-cdn.com/v4/letter/w/c37758/32.png) [@waffe](https://forum.kirupa.com/u/waffe)\
**Post date:** [July 7, 2003, 7:37am UTC](https://forum.kirupa.com/t/setselectedindex-label/24920/1 "2003-07-07T07:37:31Z")

</div>

Here is the thought:

I have two comboboxes. Both have lots of dates for the labels that look like 01/01/2003 ECT… Say these two comboboxes have a different amount of dates in them, there for the indexes are not the same. I would like it if you select one combobox the other combobox would select the same date, if it had the same date.

You could do it with setSelectedIndex if the amount of dates where the same for both comboboxes, and the order of dates where also the same.

Any Ideas would be very appreciated

:thumb:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2003, 1:28pm UTC](https://forum.kirupa.com/t/setselectedindex-label/24920/2 "2003-07-07T13:28:26Z")

</div>

well… u could use a for loop…

something like

[AS]  
comparevalue = “whatever date here”;

for(i = 0; i \< numRows; i++){  
combo2val = combo2.getItemAt(i);  
if(combo2val.label == comparevalue){  
combo2.setSelectedIndex(i);  
}  
}  
[/AS]

is that kinda what u wanted ?

-Aditya  
:thumb:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 9, 2003, 1:15am UTC](https://forum.kirupa.com/t/setselectedindex-label/24920/3 "2003-07-09T01:15:40Z")

</div>

I had to modify the code to fit my needs. I am really using it between a calendar and a comobox. Thanks for the showing me the way.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 9, 2003, 2:33am UTC](https://forum.kirupa.com/t/setselectedindex-label/24920/4 "2003-07-09T02:33:46Z")

</div>

cool!!

I was actually winging that as I went!

me proud of myself 😛

glad to help  
-Aditya  
:thumb:
