# Binding an array to ComboBox

**URL:** <https://tech-community.robotics.abb.com/t/binding-an-array-to-combobox/4133>\
**Category:** ScreenMaker\
**Created:** [April 19, 2011, 12:32pm UTC](https://tech-community.robotics.abb.com/t/binding-an-array-to-combobox/4133 "2011-04-19T12:32:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![osku](https://avatars.discourse-cdn.com/v4/letter/o/dfb087/32.png) [@osku](https://tech-community.robotics.abb.com/u/osku)\
**Post date:** [April 19, 2011, 12:32pm UTC](https://tech-community.robotics.abb.com/t/binding-an-array-to-combobox/4133/1 "2011-04-19T12:32:40Z")

</div>

Hi all!

I tried to bind a string array to ComboBox, but there is some problems with that - it doesn’t change the selected value. Both the array and the selected value controller object (num) has defined as pers. The list of strings will show up in the Combo, but selected value remains unchanged.

I also have a one ComboBox with num array and that works fine. Does anyone knows if there is some restriction of using string arrays in ComboBox?

-Osku

---

<div class="post-metadata">

**Author:** ![Abhishek\_PM](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@Abhishek\_PM](https://tech-community.robotics.abb.com/u/Abhishek_PM)\
**Post date:** [April 21, 2011, 11:16am UTC](https://tech-community.robotics.abb.com/t/binding-an-array-to-combobox/4133/2 "2011-04-21T11:16:48Z")

</div>

Hello,

I used a **small** RAPID program to reproduce the scenario you have mentioned:

MODULE ss  
PERS string task\_list{3} := [“T\_STN1”, “T\_ROB1”, “T\_ROB2”];  
PERS string sValue := “T\_ROB1”;  
PERS num s := 2;  
PROC main()  
sValue := “T\_ROB1”;  
ENDPROC ENDMODULE

The variable in use is

1. sValue which is of type string bound to SelectedValue property.
2. task\_list which is a string array

String array is bound to combo box and sValue is bound to selected Value.  
The value in the combobox changes when sValue is updated (that is while running the program or clicking of button).

I was not able to reproduce the issue, is there another scenario you were trying out.  
The selectedValue should also be a string in this case and not a num.

Thanks

---

<div class="post-metadata">

**Author:** ![osku](https://avatars.discourse-cdn.com/v4/letter/o/dfb087/32.png) [@osku](https://tech-community.robotics.abb.com/u/osku)\
**Post date:** [April 21, 2011, 10:44pm UTC](https://tech-community.robotics.abb.com/t/binding-an-array-to-combobox/4133/3 "2011-04-21T22:44:33Z")

</div>

Hello!

Thanks for your reply, you solved my problem! For some reason I thought the selected value would be the selected index and therefore binded that to num. It works fine when binded to string, so thanks again!

-Osku
