From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fundamental labview question. How to create a VI with string list for user to select from.

Solved!
Go to solution

Hi Labview masters,

I would like to create a VI program where I want a couple of string rows to be the choices for a user to select from.
What method do I use for this? A constant string will be added to the choice and then a conditional string which will be unique for each choice. So basically a list of strings, one constant string to be added to what ever choice and then a conditional string.

 

I assume that I could use cases for this?

0 Kudos
Message 1 of 11
(3,613 Views)

What you're describing is a listbox.  Hit ctrl+space on the front panel and type that into quick drop.

 

Ctrl+H will give you context help to understand a bit more about the listbox

Message 2 of 11
(3,591 Views)

I listbox looks like a table with the ability to select an item.

 

A combobox is a drop down list that you can select from.

 

Either of these options will likely solve your problem.  It is just a matter of what kind of interface you actually want.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 11
(3,568 Views)

Are you looking for something like combo box.

if so it can be traced by right clicking on the front panel control pallet , string & path and then combobox 

.

0 Kudos
Message 4 of 11
(3,536 Views)

Thank you all for your replies,

Yes I switched to combobox, liked it more.

0 Kudos
Message 5 of 11
(3,527 Views)

I was hoping to find some examples in the labview software for utilization of Combobox but find none, listbox has 2 examples.

I still do not know how to wire and then program the strings in the combo box though.

For instance if i have a combobox with 3 strings in it, iow 3 possible choices and then there should be a result
if A (selective in the combobox) is slected then a string constant1 + string constant 2 (or string from an array of three strings) to be displayed in a concatenated string as result/comment

and so on

Cheers

0 Kudos
Message 6 of 11
(3,523 Views)

Hi Chrisus,

 

if A (selective in the combobox) is slected then a…

when you wanto to start an action based on an input you most often should use a case structure!

It's the LabVIEW equivalent of an IF-THEN-ELSE-ENDIF…

 

When your "strings" look like "A, B, C" then you might use enums or even a Radio button: they can be wired to case structures and you will have their "strings" as case descriptions!

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 11
(3,488 Views)

GerdW wrote:

When your "strings" look like "A, B, C" then you might use enums or even a Radio button: they can be wired to case structures and you will have their "strings" as case descriptions!


A ComboBox has a string data type.  So you will have similar results.  Here is the beauty of the combobox: you can change the strings at runtime.  And Enum is great for when the options are constant.  But for the changing on the fly, I go with the combobox.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 11
(3,470 Views)

Okey, as the rookie I am I have to consult your expertise again guys.

I am tryign to use a combobox as the user input for the case structure. I still get the error of some cases missing selector type?


Here is my vi,

0 Kudos
Message 9 of 11
(3,421 Views)

Create a case that is called Default.  It can put out nothing or an error message or something.

 

Right now, you don't have any code that can execute if the number happens to be anything but 0, 1, 2, or 3.

 

But you have other problems.  The string only updates once you stop your VI because the terminal is outside the loop.

Also, the combo box gives a string, but you are trying to convert that to a number.  Since it is a word and not a string of numbers, it gets converted to a default of 0.

Message 10 of 11
(3,416 Views)