Windows Develop Bookmark and Share   
 index > Windows Forms General > Creating/Removing Objects at run time
 

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
deen  Wednesday, August 02, 2006 10:39 AM

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  Thursday, August 03, 2006 2:37 AM

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  Thursday, August 03, 2006 2:37 AM
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  Thursday, August 03, 2006 9:07 AM

You can use google to search for other answers

Custom Search

More Threads

• how can i programaticaly delete the selected item (row) from a listview with 3 or more columns ?
• c# Winform with google search
• Packet Scheduler miniport Error code 31
• treeview designing in windows application
• Forms resolution autosize
• "Cannot access a disposed object. Object name: 'Icon'. & System crashed...
• Visual WebGui Version 5.81.3.74.4b bringing WinForms to the web...
• How to make RichTextBox Sroll Smoother?
• Solution-Explorer > Embedded-Resource Files > How can I access them ?
• I need some help with The class Matrix()