08-28-2013 03:03 PM
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.
08-28-2013 03:45 PM
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.
08-28-2013 04:06 PM
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
08-28-2013 04:10 PM
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.
08-28-2013 04:28 PM
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.
08-28-2013 04:45 PM
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.
08-28-2013 05:45 PM
Great! Thanks
06-18-2021 09:39 AM
Hi.....am a beginer in LabVIEW. Can u plz share this vi ?
06-18-2021 10:22 AM
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!)
06-18-2021 10:28 AM
how to get the block value string?