LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

insert 2d array to listbox

Hello:
I'm using a multicolumn listbox (can select > 1 rows). In one of the vi's that I use (borrowed from the LV usergroup) I came accross a vi that is called resize2DStringArray. This checks to make sure the 2d array getting put into the listbox is big enough then increments the row/column by 1 before insertion.
The problem is, I need to keep the #columns constant and grow the #rows.
Inside Insert2DArray vi that calls the resize2DArray.vi there are checks on the current #Rows/Cols. It will call the resize if either R or C is = to the current value. My number of input cols will always be = to the current #cols.
I'm wondering if all this is even necessary????, I bypass the resize call, programmatically add data to the listbox an
d the #rows grow accordingly.
See attached vis for ref.
Thanks,
Mike
Download All
0 Kudos
Message 1 of 4
(3,893 Views)
If this VI already works for your current application, and you are just looking to streamline it then change the comparison going into the case statement from "less-than or equal to",to just "less-than". Also you must modify the cluster which goes into the resize 2D string. As the code is now, where the cluster goes into the +1 function, it will add both a column and a row. From what you say, you must break the cluster up and only add one to the row and not the column, rebundle it and send it to the subVI.

If you would like a simplified version, all you need to do is
  1. get the current elements in the listbox using the ItemNames property
  2. <
  3. insert the new data into the array you just got from the property node using the Insert into arrayB> function
  4. determine the number of rows in the resulting array using the Array Size function
  5. Change the visible rows to however many you need in the listbox using the Num Rows property
  6. and finally put the new dataset into the table by once again using the Item Names property

0 Kudos
Message 2 of 4
(3,893 Views)
Hi NKirchner:
Thank you for your reply, I will take the simpler approach as you suggest. I was wondering if the vi that grows the listbox was needed due to past bugs in LV's implementation.
Mike
0 Kudos
Message 3 of 4
(3,893 Views)
The VI that you attached that grows the listbox looks like it would be prone to odd behavior. Best bet to avoid it all together, it's not needed. Let me know if you have any problems implementing the simplified way

Thanks
Norm Kirchner
Engineering Specialists, Inc
NormK@engspec.com

PS. Don't forget to rate the reply
0 Kudos
Message 4 of 4
(3,893 Views)