In my muckaround code (well, your code, actually) this is what I did to work out wtf was happening:
Firstly, I added:
Code:
Private ListViewOnTab1 As ListView
Private ListViewOnTab2 As ListView
Private ListViewOnTab3 As ListView
to Globals. This gives us three separate and independent pointers to ListViews. A pointer is just the address of something in a computer, like an address entry in your phone book. So far, those pointers (address entries) are blank, they don't point at anything. We can use them to save the addresses of the ListViews created by LoadLayout().
Secondly, I added a line after each LoadLayout, to save a link to (ie, point to) the ListView that LoadLayout creates and points Page3ListViewer1 to:
Code:
TabStrip1.LoadLayout("Page3", "TAB 1")
ListViewOnTab1 = Page3ListView1
...
TabStrip2.LoadLayout("Page3", "TAB 2")
ListViewOnTab2 = Page3ListView1
...
TabStrip3.LoadLayout("Page3", "TAB 3")
ListViewOnTab3 = Page3ListView1
After all that is done, you have three tabs, with an independent list on each tab (with, from memory, 5, 8 and 10 sample lines respectively)
If you want to add to the list on Tab 1, then: ListViewOnTab1.Add...()
If you want to add to the list on Tab 2, then: ListViewOnTab2.Add...()
If you want to add to the list on Tab 3, then you can either: ListViewOnTab3.Add...()
OR if you want to make yourself crazy, you could ALSO use: Page3ListView1.Add...()
because both ListViewOnTab3 and Page3ListView1 are pointing to the
same ListView (ie, the one on Tab 3)
So, there you have it. Easy (when you know how ;-)
Your next problem is that you have three Button1s (one one each tab), and they will all be calling the one routine Button1_Click. So if you change Button1_Click to now adds lines to ListViewOnTab2 rather than Page3ListView1, then you are again in the situation where clicking Button1 on any of the three tabs is going to add to the specified ListView rather than the ListView of the current tab that contains the button you just clicked.
I'm going to let you work on that issue. I haven't done it before, but my first thought is to use the Tag field of each button to distinguish between Button1s on various tabs. To set the tags, it might be possible to use something like TabStrip1.Button1.Tag = "1" or TabStrip2.Button1.Tag = 2 (if tags can be non-string). If that doesn't work, then I'd think back to how the Page3ListView1 pointer was updated by each LoadLayout to point to the ListView on the tab just loaded, and then think well maybe LoadLayout is also updating the Button1 pointer too, and try:
Code:
TabStrip1.LoadLayout...
Button1.Tag = 1
TabStrip2.LoadLayout...
Button1.Tag = 2
TabStrip3.LoadLayout...
Button1.Tag = 3
Either way, you should be able to access the Tag of the clicked button using the Sender keyword:
Code:
sub Button1_Click
select case Sender.Tag
case 1: ListViewOnTab1.Add...()
case 2: ListViewOnTab2.Add...()
case 3: ListViewOnTab3.Add...()
case else: Log("There is another Button1 out there somewhere")
end select
end sub
If Tags are numbers rather than strings, that'll probably be faster.
And lastly, remember that an array of objects is really an array of (small)(ish) pointers, NOT an array of the actual full objects themselves. Thus you can have:
Code:
Dim WhereDidAllMyListsGo(100) as ListView
and you have yourself 100 (initially empty) pointers (address book entries) that you can use to keep track of (up to) 100 different ListViews without needing to DIM 100 separate and differently-named ListViews, when and as the needs arise.
Right, I think you've got enough rope now to do what you need to do. Me, I need to sleep, so it's over and out from down under.