PC Review


Reply
Thread Tools Rate Thread

Create TabPages at runtime (with controls)

 
 
Luc
Guest
Posts: n/a
 
      20th May 2004
Hi,

I have a TabControl and, at runtime, I need to add some tabpages. The
problem is that each tabpage is similar to the others and contains several
controls.

If I do TabControl.TabPages.Add(MyTabPage), a new BLANK tabpage is added.
How can I add in few statements a new tabpage as well as its controls
(textboxes, labels, etc.)? The first tabpage (that I create at design time)
is the "template" to be used for the other tabpages. Is there a way at
runtime to duplicate the first tabpage and create new tabpages based on this
one (including controls)? Also: how can I reference (at runtime) the newly
created tabpages and their controls?

Thanks,

Luc



 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      20th May 2004
"Luc" <(E-Mail Removed)> schrieb
>
> I have a TabControl and, at runtime, I need to add some tabpages.
> The problem is that each tabpage is similar to the others and
> contains several controls.
>
> If I do TabControl.TabPages.Add(MyTabPage), a new BLANK tabpage is
> added. How can I add in few statements a new tabpage as well as its
> controls (textboxes, labels, etc.)? The first tabpage (that I create
> at design time) is the "template" to be used for the other tabpages.
> Is there a way at runtime to duplicate the first tabpage and create
> new tabpages based on this one (including controls)? Also: how can I
> reference (at runtime) the newly created tabpages and their
> controls?


You could create a Usercontrol and put it on the first TabPage. Then, at
runtime, create new instances of the Tabpage and the Usercontrol.

Or, derive your own class from the Tabpage class, but you won't be able to
use a designer to design it.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create controls at runtime TonyMast Microsoft VB .NET 6 6th Apr 2006 12:16 PM
How to create controls at runtime Andy Chan Microsoft Excel Programming 3 30th Aug 2004 10:07 AM
How to create controls at runtime michele Microsoft ASP .NET 1 4th Aug 2004 08:28 PM
creating runtime tabpages with runtime controls C# Elp Microsoft C# .NET 1 16th Jul 2004 04:38 PM
Create controls in runtime Alberto Microsoft ASP .NET 4 10th Mar 2004 05:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:31 PM.