LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combo box to array

Hi,

I am trying to have an array of numbers which displays which value of the combo box is choosen.

For example, if we choose a string "hello" which is at number 3 in the drop down list in the combo box, the third element of the numerical array should change to 1 to show that the third string was selected (and this value should be retained for successive iterations).

 

 

 

0 Kudos
Message 1 of 20
(4,126 Views)

Hmm, makes me curious.

3th in drop down combobox, so 3th element of the array (probably 2) and the value you want to get is 1?

 

0 Kudos
Message 2 of 20
(4,117 Views)

Your requirements are not clear. You say "value", but you seem to be referring to the index of the item selected. What are the other elements of this array supposed to show?

 

Based on the little that you've indicated, initialize an array with blank/default values, and then in your program, simply replace the array element when the combo box selection is made. I am assuming you have an event structure.

0 Kudos
Message 3 of 20
(4,113 Views)

If i understand correctly it's rather simple.

 

The Value of the combo box is the index chosen (let's call it X). Change the X position of your numerical array to True or 1 or +1 (depending on your design) with a replace array subset.

 

Keep the numerical array in a shift register or Action engine.

 

/Y 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 20
(4,106 Views)

Hi,

I have been working on it and this is what i came up with (see attached file). In this program the user can choose any string form the combo box and the program will compute the string length and display it in the array at the specific point, e.g. if the user chooses the third number string the third element in the array will be changed.

However, the problem is that each time the user chooses a string all other array elements turn to zero. I want them to retain their value. how can i do that? Please if any one can modify my program it would be a great help because my whole project is stuck due to this little glitch. . 

Also i noticed that the first array element does not change? why is that?

 

Thanx

0 Kudos
Message 5 of 20
(4,068 Views)

Btw its the same problem that i stated before the only difference is that instead of putting in only +1 or -1 I am inserting string lengths

0 Kudos
Message 6 of 20
(4,070 Views)

@Mylo wrote:

 

Also i noticed that the first array element does not change? why is that?

 

Thanx


The Case structure is case sensitive "Blah blah" does not equal "Blah Blah".  The is an option to make the case structure
Case Insensitive

 

Right Click the structure and select "Case Insensitive Match"

 

Ken

0 Kudos
Message 7 of 20
(4,059 Views)

@Mylo wrote:

Hi,

I have been working on it and this is what i came up with (see attached file). In this program the user can choose any string form the combo box and the program will compute the string length and display it in the array at the specific point, e.g. if the user chooses the third number string the third element in the array will be changed.

However, the problem is that each time the user chooses a string all other array elements turn to zero. I want them to retain their value. how can i do that? Please if any one can modify my program it would be a great help because my whole project is stuck due to this little glitch. . 

Also i noticed that the first array element does not change? why is that?

 

Thanx


 Since you have 3 empty exits of your case structure those will be 0'd. That's why you need the Index of the combo box (property node probably) and change only that one, else you're on the right track.

/Y 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 20
(4,056 Views)

Run the vi with highlight execution on and you will see that you are inserting all elements into the array on every loop the unwired ones from the case structure defaulting to zero.

 

you need to use the index of he combo box

 

You could use a Test Ring rather than a Combo Box - you get the index for free and you can get the string by indexing the Strings[ ] property

 

Ken

0 Kudos
Message 9 of 20
(4,055 Views)

With a Text Ring as Ken says you'll get the index directly and can get the text through a property, with the combo box you get the text directly and need to use Search array through Array[] property to get the index.

 

Different controls, different strengths.

 

/Y 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 10 of 20
(4,046 Views)