LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I clear a listbox of all items?

I am using a listbox as a way to display messages. How can I clear the messages from the listbox (maybe using a property node) and is there a simple way of limiting the number of items in a list box? Thanks in advance!
0 Kudos
Message 1 of 12
(8,481 Views)
hi there,

Hope my example vi will help in one way or another.


ian.f k
spokesman@ianfung.net
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
Message 2 of 12
(8,482 Views)
Never mind...I think I figured it out. I am using "item names", a property node of the list box, tagged to array size. The array size is wired to a for loop which is used to clear each item in the listbox with a null string. It seems a klunky way of doing it, but it works.

I think I'm going to use the same method to limit the maximum number of items. I'll do this by monitorring when I hit 50 elements, at which point I'll clear the 50th element using the null string.

Does anyone have suggestions for more direct solutions than using a for loop?
0 Kudos
Message 3 of 12
(8,481 Views)
I thought that that was already a quite straight forward method??

You may see many things in case: WriteListItems
In fact all you have to do is

1. Remove the "Extract Numbers" code
2. Use only the integer, change it to, say, 50, for your case.
3. Replace the Array Constant in the loop with your Item Array

See attached
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 4 of 12
(8,481 Views)
Hi,
To control the number of items in the listbox you must use its "ItemNames" Property. This is array of list items.

1. To clear the listbox you just need to wire the empty array to this property node "ItemNames".

2. To add some new element you just need to add with "build array" function new lement to "ItemNames".

3. To limit number of elements in listbox you just need to wire the array with limited number of elements (use Array Subset function) to "ItemNames".

4. To remove element from list you just need to remove some element from "ItemNames".

The example is attached.

Oleg Chutko.
0 Kudos
Message 5 of 12
(8,483 Views)
Thanks you. I've been having problems with list boxes and this helped me understand them. But I am still having issues with them going from 7.1 to 8.0. In 8.0 I get an error when using "TOP ROW"


0 Kudos
Message 6 of 12
(8,232 Views)
(I would recommend to start a new discussion Instead of adding to a thread that is over four year old.)
 


@frontiergeo wrote:
...But I am still having issues with them going from 7.1 to 8.0. In 8.0 I get an error when using "TOP ROW"


What kind of "error" do you get? Does the error only occur when upgrading? How are you using the "top row" property? Can you attach a simple program that deomonstrates the error?
0 Kudos
Message 7 of 12
(8,228 Views)
Good idea. I reported it in the main forum. under "listbox property errors in LV8.0"
0 Kudos
Message 8 of 12
(8,208 Views)

Hi.

I am trying to clear my listbox. I have wired an empty array to the ItemNames value, but only the first element is cleared.

How do I clear them all? (see attached)


\
Angus Cattle from Pool Ranch and Steel Repairs via Joe's Welding.
0 Kudos
Message 9 of 12
(8,022 Views)
If you are talking about your Make Selection case, you do not have an empty array.
0 Kudos
Message 10 of 12
(8,014 Views)