I have the following combo box:
Item value
A aaaa1
B bbbb2
C cccc3
Suppose the second Item is selected.
How can I programatically select the next item?
OBS: I don't want change an item name (String) or Value.
Solved! Go to Solution.
If I'm understanding you correctly, you just want to programmatically select the next item in the combo box, correct? If so, the following code would do it, it just finds the index of the current item and increments it then rolls back to 0 if you're at the end of the combo box.
--Ryan S.
Yes, thanks.
And now, there is an easier way to implement the following code?
Type Cast function (converting to a Combo Box's constant) does not work. One case for each item is boring to code...
Regards
I can understand how coding a case for each item would be boring and I wouldn't recommend it...as for an easier way, what's wrong with the above code? It's not all that complicated, and if you want it to take up less room on the block then turn it into a subVI. As long as you use a reference and not explicitely defined property nodes, then you can just use the above as a subVI to get you the next value.
--Ryan S.
Thank you.
I will use the "case" to select a default value from a .txt file, and then use your code to go to the next items.
Oh, ok, I misunderstood your previous post. For initializing, you could use a similar approach with a For loop to find and set the value of the combo box based on a configuration value. The code would look like:
--Ryan S.
Great! Thanks
Hi.....am a beginer in LabVIEW. Can u plz share this vi ?
Hi Parvathi^4,
@Parvathiiii wrote:
Hi.....am a beginer in LabVIEW. Can u plz share this vi ?
As a beginner you should go through all those Training resources offered at the top of the LabVIEW board.
There you will learn about "code snippets" and how to use them.
(The code posted 8 years ago is presented in such snippets!)
how to get the block value string?