Using tabs... already load objects?

Lanc1988

Contributor
Joined
Nov 27, 2003
Messages
508
I have some tabs on my form and when i click to go to one that has quite a few objects on it, it kinda takes a second to load them in.. is there some property i can set to have it have all the objects loaded and kept in memory so its like instant when you go to the next tab?
 
I will present you with a new approach on how to deal with the TabControl.

For some time, I used the tabcontrol as simple as it can be... create the tabs, put the controls on it, create the eventual databindings and we're set...

This way os doing it causes 2 main problems:
One problem was quite what you have... some tabs took forever to load the first time... as they only set databindings when the first "load".
The other problem was the mess the code was... As the number os tabs increases the controls names became biger... a mess to find what so ever...

What I recoment is to create a clean tabcontrol, and create seperated usercontrols, each one of them representing a tabpage.
This way... each usercontrol will have its own code, and you can control where to start the bindings... on:
-> NEW() - Slower main form load but faster navigation.
-> LOAD() - Faster main form load but slower (first time) navigation.

Then on the form that have the tabcontrol, create the tabpages by code and add the related usercontrol to each on of them...

Cheap and clean...

Alex :p
 
Back
Top