LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically Update Combobox Getting Duplicates in LabVIEW

Solved!
Go to solution

New to LabView and am using 2017 version.  I have a combobox that is already populated with items and a user will be able to add to the combobox items by entering a new string value and pressing a button.  The button is in an event structure which is inside a while loop.  The problem is when the new string value is updated in the combobox there are two.  Is there anything that can be done to prevent the duplicate?

 

Thanks

0 Kudos
Message 1 of 10
(3,791 Views)

Before adding the new value, use Search 1D Array to see if the new value is in the Strings[] array first.  If it is not, then you can add the new value.


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
0 Kudos
Message 2 of 10
(3,782 Views)

Thank you for the reply and the tip.  I will add the Search 1D Array to prevent any duplicate values.

 

The problem I am having is when the pusbutton is pressed to add the new string it adds two of the new string instead of only one.  I'm not sure if it's a timing issue or if the array will need to be evaluated after the new string is added to delete any duplicates.

0 Kudos
Message 3 of 10
(3,776 Views)
Solution
Accepted by topic author kadilakd73

You're using references unnecessarily.  Use property nodes that are linked to the control.

Also, the terminal for the stop button needs to be in it's own Value Change event.

ap.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 4 of 10
(3,772 Views)

Change the boolean action from "switch until released" to "latch when released"

0 Kudos
Message 5 of 10
(3,764 Views)

Works great.  Thanks for your help.

0 Kudos
Message 6 of 10
(3,758 Views)

It can also be done without the button.  Combo boxes allow undefined values at runtime.  Setup a Value Change on the combo box, check for duplicates and add the new value to the Strings array. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 7 of 10
(3,757 Views)

This was in response to paul_cardinale.

 

First time on the forum.

0 Kudos
Message 8 of 10
(3,756 Views)

@kadilakd73 wrote:

This was in response to paul_cardinale.

 

First time on the forum.


Use the quote button to make reference to a specific message.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 9 of 10
(3,752 Views)

Thanks.


@aputman wrote:

@kadilakd73 wrote:

This was in response to paul_cardinale.

 

First time on the forum.


Use the quote button to make reference to a specific message.


 

0 Kudos
Message 10 of 10
(3,744 Views)