LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Correctly handling a combo box output

Solved!
Go to solution

A combo box will output one of two types of data.  If it finds the value entered on its front panel control in the strings column of the Strings and Values[] array, it will output the corresponding value cell.  Otherwise it will output the string.  So, if my Strings and Values[] array looks like this:

 

Red, 0

Yellow, 1

Green, 2

 

and I enter "Orange", then the combo box outputs "Orange".  If I enter "Yellow", then the combo box outputs "1" rather than "Yellow".

 

Is there any method to determine which behavior the control used?

0 Kudos
Message 1 of 3
(3,649 Views)
Solution
Accepted by topic author kc64

Actually, the datatype is always a string. The "value" needs to be interpreted as a numeric by you. Off the top of my head, you have 2 ways you can do this:

  • Use Search 1D Array to search the Strings[ ] property to see if the combobox's Text.Text property is in the list of strings. If the output of the function is -1 then you know it simply returned the string.
  • You can use the Decimal Digit? function to see if the value is numeric.

I'm sure there are others.

Message 2 of 3
(3,640 Views)

Thanks, s.

 

Exactly what I needed.

0 Kudos
Message 3 of 3
(3,632 Views)