Inserting on a Table or Listbox or Arraylist

linum

Active Member
Licensed User
I've been reading the forum trying to find out if it's possible to insert an item, row into a Table, Listbox or Arraylist after another index (so not at the bottom). In other words, if I have a Table (or listbox or arraylist) with 10 indexes and I want to add a new item after index 5.

So far I found posts specifying that it might not be possible. One thing that I've learned about the excellent programmers here on the forum is that when something isn't possible then there is usually a work around to accomplish the impossible. Could there be a trick way for me to accomplish this? Maybe on a second Table/Arraylist move the items up-to the desired index, add the new item there after, continue copying the remaining items then clear my original Table/Arraylist and copy all items from the second Table/Arraylist into the first? If so, is there an example that can show me how to do this?

As always, thank you for your fine help...
 

specci48

Well-Known Member
Licensed User
Longtime User
Hello linum,

the listbox and the arraylist support the method insert with the Syntax: Insert (Index, Value).
E.g.:
B4X:
ComboBox1.Insert(2, "Item at 3rd position")

A table doesn't support the insert feature. :sign0013:
Maybe you can help yourself using tablesort after the new row has been added.



specci48
 

linum

Active Member
Licensed User
Great! So that means I can insert an item to my arraylist...


Thank you so much...
 
Top