Creating/Removing Objects at run time

hi
Is it posible to create just a Form and a TabControl but only load up the objects when the tabs are clicked thus removing the objects from that tab when another tab is clicked at run time?

I noticed when you have a Form with a TabControl there could be a lot of objects placed on the Tabs but it seems to respond slowly when clicking the Tabs. My plan was to use another .h file to load/unload the objects when the Tabs were selected so the application would only load what was in view and removing the rest until another Tab was pressed. thanks

[554 byte] By [deen] at [2007-12-23]
# 1

Hi deen,

Of course, you can create or remove the objects at run time. You can implement the Enter & Leave event of a tabpage.


private void DoEnter(object sender, EventArgs e)
{
MessageBox.Show("Enter");
}

private void DoLeave(object sender, EventArgs e)
{
MessageBox.Show("Leave");
}

But the overload of the creation and remove of the controls at the time of tab change may be big too. So whether it is worthwhile is up to the app.

gqlu at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2
heh you were right it is slower to add and remove Objects this way especially when there are a large amount of Objects, it seems a lot faster the way it already was. thanks
deen at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...