LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add Items in combo box at runtime

Solved!
Go to solution

In my program, I want to add int "34" "43","17"...... and let user choose one of them from combo box. How can I add such items in combo box at runtime. Create a property node "String[]"? I try that but its display is "3443". I wanna to display like "34"

                                                                                                                                                                43

                                                                                                                                                                 17

0 Kudos
Message 1 of 11
(7,817 Views)

Did you wire an array of 3 elements to the property node? A string with linefeed wont do.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 11
(7,812 Views)
Solution
Accepted by topic author song403

See attached snippet

 

Add to combo.png

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
Message 3 of 11
(7,802 Views)

In my program, I fetch data one by one. first, I fetch 34, second, I fetch 43 and so on. So I want to add item one by one also. but  I can not link string to string[]. So how can I do?

0 Kudos
Message 4 of 11
(7,773 Views)

Hi song,

 

collect your strings in an array and wire the array to that property node.

That's how it works!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 11
(7,764 Views)
Solution
Accepted by topic author song403

Seeattachedsnippet,itmayhelp.

 

combobox.png

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
0 Kudos
Message 6 of 11
(7,759 Views)
Solution
Accepted by topic author song403

Just a small tip.

 

Adding Strings[] is probably not ideal unless Values = strings property is true and I can't tell if it is from the OPs question!  Better practice is to use the Strings and Values[] property and add both the string and the value


"Should be" isn't "Is" -Jay
Message 7 of 11
(7,744 Views)
Solution
Accepted by topic author song403

One more question. How can I clear items from combo box when my program start up. use another property?

0 Kudos
Message 8 of 11
(7,711 Views)
Solution
Accepted by topic author song403

Hi song,

 

use the very same property - and wire an array only containing the strings/values you need…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(7,679 Views)
Solution
Accepted by topic author song403

If you want to clear the contents of combo box, just create array constant for the same property node and do not include any element in that array. (empty array)

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
0 Kudos
Message 10 of 11
(7,670 Views)