469,271 Members | 1,727 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Dynamic create tab pages on a tab control

I done some looking on Google and could not come up with a way to
dynamically create tab pages on a tab control.

Does anyone have a link to any examples.

Regards
Jeff
Oct 24 '07 #1
3 21950
Jeff,

Why not just use the Add method on the TabPageCollection returned by the
TabPages property on the TabPage control?

// The tabpage.
TabPage tabPage = new TabPage();

// Add to the tab control.
tabControl.TabPages.Add(tabPage);
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeff" <jeff@[_nospam_].hardsoft.com.auwrote in message
news:13*************@corp.supernews.com...
>I done some looking on Google and could not come up with a way to
dynamically create tab pages on a tab control.

Does anyone have a link to any examples.

Regards
Jeff

Oct 24 '07 #2
Thanks Nicholas

I have come from another programming language where each tab was a form
and thought this would be harder than you just indicated.

Ok now how can I stop the pages from being added to the form on
initialization.

At the moment when a form open it creates all the tabs which takes time.
Is there a property I can set to prevent the pages being created and
then use this method to add the ones I want.

Nicholas Paldino [.NET/C# MVP] wrote:
Jeff,

Why not just use the Add method on the TabPageCollection returned by the
TabPages property on the TabPage control?

// The tabpage.
TabPage tabPage = new TabPage();

// Add to the tab control.
tabControl.TabPages.Add(tabPage);

Oct 24 '07 #3
Jeff,

If you don't want the pages to be added when the form is opened, then
you will have to remove the pages, and then add them programatically
elsewhere.

You can look at the designer-generated code and move that to another
section.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeff" <jeff@[_nospam_].hardsoft.com.auwrote in message
news:13*************@corp.supernews.com...
Thanks Nicholas

I have come from another programming language where each tab was a form
and thought this would be harder than you just indicated.

Ok now how can I stop the pages from being added to the form on
initialization.

At the moment when a form open it creates all the tabs which takes time.
Is there a property I can set to prevent the pages being created and then
use this method to add the ones I want.

Nicholas Paldino [.NET/C# MVP] wrote:
>Jeff,

Why not just use the Add method on the TabPageCollection returned by
the TabPages property on the TabPage control?

// The tabpage.
TabPage tabPage = new TabPage();

// Add to the tab control.
tabControl.TabPages.Add(tabPage);
Oct 25 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by gg.2.starfire | last post: by
15 posts views Thread by theo | last post: by
1 post views Thread by Grey | last post: by
3 posts views Thread by Grey | last post: by
1 post views Thread by zhouzhendong | last post: by
1 post views Thread by rushikesh.joshi | last post: by
5 posts views Thread by Charles Zhang | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.