tags:

views:

22

answers:

1

I want to create a UI that uses a tab control to display multiple listview controls, one on each tab page. The number of tab pages/listviews is dynamic and could reach around 20. The listviews are in virtual mode and are populated from an object (custom class) in memory.

It seems very wasteful to create 20 listviews. I seem to remember that back in VB4 days the tab control had only one page, and you changed the display yourself in code. Is there a way to do something similar with VB.net (VS2008/Framework 2.0) i.e. just show one listview and repopulate it according to which tab was clicked by the user? Something like this:

Private Sub Tab_Click
    listview.load(MyObject(TabClickedIndex))
End Sub

Thanks for any advice.

A: 

The controls on the tabpages aren't actually created until the tabpage is selected, so unless the user wants to look at that one list it won't use resources.

And if the user wants to look at all lists on all tab pages, then he's likely to want to move back and forth between them and so I'd thought that it would be faster to just show an already loaded list than to clear it out and then re-populate it.

I'd also have thought that the code would be clearer if each list could only have one set of data instead of trying to squeeze up to 20 different kinds of lists into one.

So all in all, unless you've measured that there's some kind of performance issue I would just go with having one listview per tabpage.

ho1
Thank you ho1. It did occurr to me that the listview might not populate fast enough to give a good user experience. I will go with multiple tabPages/listviews and see how that pans out.
Guy