Binding an array to ComboBox

osku
osku Finland ✭✭
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 

Comments

  • Abhishek PM
    Abhishek PM Bangalore
    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

     
  • osku
    osku Finland ✭✭
    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

Sign In or Register to comment.