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: 

How can you change a drop down menu's selection in a case statement?

Solved!
Go to solution

Hi,

I am trying to an array finding vi. This VI will take an existing xml file and after the user has selected his/her equipment, input, output, and frequency it will put all of those options into a string and search the xml file for that exact array name and display it on an output screen. The problem I am having is that my input and outputs selection needs to be a little different depending upon the equipment selected. I thought that I could use a case statement to change the input and output selectable options, but I have run into many snags with it. For one everytime I place a new Input and Output drop down menu in the case statement it wants to place a new one in the front panel (I only want one input and output not three I have two inputs and outputs hidden right now). I believe I am using the case statement wrong... Can anyone help change my input and output selectable options depending upon the equipment selected. Attached is my xml file, Array Find.vi (the original one), and Array Find_Test.vi (this is the one I am trying to modify).

 

Thanks,

dlovell

0 Kudos
Message 1 of 6
(4,086 Views)

Hi dlovell,

 

There are 2 key things I'd recommend for the code - using property nodes to edit the strings in the combo boxes.  Something like the following snippet:

 

Edit Strings.png

 

Also, check your CPU in task manager when running the code.  It will eat a whole core of your machine (25% quad core, 50% dual, 100% single) - that is because you are running the while loop and polling the control as fast as Windows will allow you to.  Using Event Structures is a much more efficient way of working in this example.

 

Check out the MOD attached Smiley Happy


Regards,

Peter D

0 Kudos
Message 2 of 6
(4,072 Views)

So I am confussed with this example... What I am trying to do is when my equipment drop down menu changes the input and output options change, this is why I was trying to use a case statement. Your program changes all three and they are the same values. I tried modifying it but I can't seem to. Any help with modifying this?

0 Kudos
Message 3 of 6
(4,053 Views)
Solution
Accepted by topic author dlovell

Hi dlovell,

 

A couple of edits to the VI attached:

 

Requirements/Possible Solutions

 

  • When the equipement value changes, do something
    • Add event case for Equipment Value Change
  • Do something = Decide what strings to write, change Input and Output strings
    • Read value Equipment changed to
    • Make decision (case structure)
    • Edit strings (same method as previous mod)

Hope this helps Smiley Wink


Regards,

Peter D

Message 4 of 6
(4,044 Views)

Thanks that was what I was looking for!!!

Thanks!!

0 Kudos
Message 5 of 6
(4,041 Views)

No problem, glad it helped!

 

One quick thing - notice how if you type something other than Equipment 1 or Equipment 2 the case structure defaults to the 1 - Input x / 1 Output x strings.  This is as Equipment 1 is the default case.

 

It will probably be worth unchecking the "Allow Undefined Strings" option for your combo boxes:

 

menu.png


Regards,

Peter D

0 Kudos
Message 6 of 6
(4,037 Views)