LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Listbox to listbox, add and remove

Hi,
I'm quite new to Labview and i have this problem with a wired listbox.
- 2 listboxes
- add and remove buttons
First listbox has the users and i want to add the users to the other listbox (i.e. users in a project).
I've got the adding and removing to work somehow. Now the problem is that there is also "empty" strings that interfere with the adding and removing. So i can add "unlimited" empty strings when i remove or add users. I've tried to disable the "function" whenever an empty string is added, but with no good results.
0 Kudos
Message 1 of 6
(3,569 Views)
Can you attach your Vi so that we can look at how you did it and help you fix it?
0 Kudos
Message 2 of 6
(3,564 Views)
Here you go. I tried also to check if the value chosen is "-1", but it didn't work.
0 Kudos
Message 3 of 6
(3,547 Views)
A few points:
  • In the initialization frame you don't need to use the "Initialize Array" function. Just wire an empty array constant.
  • When you perform the "Add User" operation you don't need to use the "Insert Into Array" function. Just use the "Build Array" function. It's irrelevant where the new element gets added since you're sorting the list anyway.
  • For the life of me I can't figure out why you're using the "DblClick Row" property as an index value. All you need to do in the "Remove User" case is the exact same thing you're doing in the "Add User" case, but swap the listboxes. Then, the VI works as intended.
  • You can encapsulate the user movement from one listbox to another into a subVI by providing to the subVI a "from" listbox control reference and a "to" listbox control reference. Then you can use the same subVI in both cases. Simpler code. More easily managed.
Message 4 of 6
(3,518 Views)
I have made a list of changes to your Vi and it should work for you now. See the block diagram for the changes that I made.



Joe.
"NOTHING IS EVER EASY"
Message 5 of 6
(3,518 Views)
Thank you very much. Your improvment ideas are really important because i've just started with labview and havn't gone any courses. The double click thing was just a test of what is better for the user, buttons or double click. So that's why the two different types of "navigation".
Thank you all for your help.
0 Kudos
Message 6 of 6
(3,494 Views)