ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Combo box to create options

Hello,
I am using a Framegrabber to acquire my images from our custom made sensors. We have several models so I wrote several Drivers for each one. I have managed to use a combo box with the names of the sensors to select which driver is loaded into the IMAQ board. However, because the application is getting more and more complex, and because I want to have one universal application for all our sensors, I want to have the ability to select different options according to the driver that is selected. For example, if I select Sensor A, and I want to use the serial communication, I want the address of sensor A to be used in the VI. If I choose Sensor B, the values related to sensor B are to be chosen. I guess the idea is simple to implement using an If Statement in C or other languages, but I don't want to go through that mess, and I want to implement it with LabVIEW.

I could use a Case structure, but that only gives me two options. And I am not very good with Event structures and I do not know if I can use it for this. I also tried to use a local variable, but it would not let me change the values associated with the labels.

If you understood what I was trying to say, and have an idea, I would greatly appreciate your help. If you are interested in helping but need a visual illustration, I can put a quick VI together for you.

Thank you in advance,
Rami
0 Kudos
Message 1 of 6
(6,728 Views)

@Rami_Y wrote:
...I could use a Case structure, but that only gives me two options...

Wrong ! 😉
The case structure can handle multiple cases : just wire your combo box to the case input !
That's one of the greatest LV functionnalities...
CC
Chilly Charly    (aka CC)
Message 2 of 6
(6,726 Views)
Hello CC

You are absolutely correct. This is as good as a traditional If Statement.
Thank you very much, I am sure this small tip will open a lot of doors for me. Hahaha.
Thanks again
0 Kudos
Message 3 of 6
(6,722 Views)
Hi.

I think I am doing something wrong, but, maybe someone can quickly enlighten me.

The situation is this.

I have a combo box with about 65 values. I want to feed these into a case structure (to select a range of settings to use later on)

How do I get the values to also appear in the case headers? All I have is true and false..

My output of the combo box is a string, not  a number. is that why I dont get the values automatically?

I've attached the combobox and a case structure.

/Brian
0 Kudos
Message 4 of 6
(6,574 Views)
If you want 'text' to automatically show up in the selector of a case statement, use an enum instead of a combo box.
0 Kudos
Message 5 of 6
(6,568 Views)
Ok, so that is what I am doing wrong...

Thanks.
0 Kudos
Message 6 of 6
(6,563 Views)