01-24-2018 01:16 AM
Hello , i am using multicolumn listbox to display data having N rows and 6 columns. The 0th column in my multicolumn listbox is of serial numbers. I have added the functionality of adding or removing items from the listbox. I just want that if i remove data from a certain row , then the serial numbers get adjusted in numeric order. For e.g i have data in my multicolumn listbox with serial numbers as 0,1,2,3,4,5,6. Now , if i delete data of serial number 3 then , i should get 0,1,2,3,4,5 on my multicolumn listbox instead of 0,1,2,4,5,6. Please help me how can i do this?
01-24-2018 01:23 AM
Hi shaun,
so you just want to re-number the first column in your listbox?
Just do it!
- Keep your array data in a shift register.
- iterate over all rows.
- replace the first element of each row by your index number
Reminder: When you have problems with your VI you should attach that VI…
01-24-2018 01:29 AM - edited 01-24-2018 01:31 AM
Well, the items is just a 2D array of strings, so you simply need to sort the entries and write them back.
I think there is an openG tool to sort 2D arrays by a certain column, or you can write your own version.
Depending on how the numbers are formatted, you might need to do a numeric sort unless they all have the same number of digits (The default sot for strings is alphabetic).
01-24-2018 02:48 AM
can u tell me how can i update the items in only the first (0th) column of multicolumn listbox instead of updating all of the columns ?
01-24-2018 02:58 AM
01-24-2018 03:00 AM - edited 01-24-2018 03:01 AM
You need to rewrite all items. Assuming you have the 2D array of strings stored in a shift register, you can replace the first column with a new 1D array using "replace array subset". Then write back the listbox items.
It would be significantly easier to suggest a solution if you would show us your VI. Please attach it.