dynamically adding separately created tabpage to tabcontrol 
Author Message
 dynamically adding separately created tabpage to tabcontrol

Hey there...I understand how to add tabpages to a tabcontrol in C#, but what
I want to do is be able to create a tabpage (separately) that I can
dynamically add to the tabcontrol at runtime.  On the Visual C# new projects
menu, I tried to go into Windows Control Library to create a new control
that was simply a tabpage that I could customize in-depth, but it doesn't
look like there's any way to do that.  It seems like maybe it will let me do
an entire "standalone" tabcontrol, but I don't think that would be the best
thing for me.

Basically, my app's tabcontrol will have a "main" sort of tabpage that will
always be there, and then one other kind of tabpage that there can be
multiple instances of.  There can be a virtually unlimited number of these
other tabpages open--that's why I'm trying to use a tabbed app instead of an
MDI one (cut down on the disorganization that can ensue with tons of
documents open).

How can I implement this?

On an MSDN webpage, I found this way to programmatically add a webpage:

TabPage myTabPage = new TabPage(title);
tabControl1.TabPages.Add(myTabPage);

That's straightforward and all, but is there a way for me to set up that
webpage ahead of time using the visual editor, or do I have to hand-code
this?  Also, are there problems I'm not forseeing, like having to get the
form to learn about the new tabpages' event handlers, etc.?

Thanks!

Please make sure a response also goes to my email address:



Wed, 12 Jan 2005 23:22:21 GMT  
 dynamically adding separately created tabpage to tabcontrol
Hello Stephen,

A class derived from TabPage doesn't support Form Designer. However, you
may design a TabPage derived control in VS.NET. You may specify its
property, event and other members except visual effect. If you don't want
to write all these code by yourself, you may design a TabPage in a Form and
then copy the related code to your control's InitializeComponent method.

I hope this helps.

Best regards,

Lion Shi, MCSE, MCSD
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.  2001 Microsoft Corporation. All rights
reserved.
--------------------

    Subject: dynamically adding separately created tabpage to tabcontrol
    Date: Sat, 27 Jul 2002 10:22:21 -0500
    Lines: 34
    X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

    Newsgroups: microsoft.public.dotnet.languages.csharp
    NNTP-Posting-Host: 128.42.154.192
    Path: cpmsftngxa08!tkmsftngp01!tkmsftngp12
    Xref: cpmsftngxa08 microsoft.public.dotnet.languages.csharp:79029
    X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

    Hey there...I understand how to add tabpages to a tabcontrol in C#, but
what
    I want to do is be able to create a tabpage (separately) that I can
    dynamically add to the tabcontrol at runtime.  On the Visual C# new
projects
    menu, I tried to go into Windows Control Library to create a new control
    that was simply a tabpage that I could customize in-depth, but it
doesn't
    look like there's any way to do that.  It seems like maybe it will let
me do
    an entire "standalone" tabcontrol, but I don't think that would be the
best
    thing for me.

    Basically, my app's tabcontrol will have a "main" sort of tabpage that
will
    always be there, and then one other kind of tabpage that there can be
    multiple instances of.  There can be a virtually unlimited number of
these
    other tabpages open--that's why I'm trying to use a tabbed app instead
of an
    MDI one (cut down on the disorganization that can ensue with tons of
    documents open).

    How can I implement this?

    On an MSDN webpage, I found this way to programmatically add a webpage:

    TabPage myTabPage = new TabPage(title);
    tabControl1.TabPages.Add(myTabPage);

    That's straightforward and all, but is there a way for me to set up that
    webpage ahead of time using the visual editor, or do I have to hand-code
    this?  Also, are there problems I'm not forseeing, like having to get
the
    form to learn about the new tabpages' event handlers, etc.?

    Thanks!

    Please make sure a response also goes to my email address:



Sat, 15 Jan 2005 17:16:06 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. TabControl tabpage change

2. how CFormView transfer values to it′s tabcontrol and in it embeded tabpages

3. TabControl/TabPages

4. Adding objects to a tabpage programmitically

5. Any way to create a better looking TabControl?

6. How to dynamically add controls to DataGrid?

7. How to handle an event fired from a control that was added dynamically

8. dynamically adding web controls

9. How can i add web controls dynamically?

10. help working with context menus and adding menu items dynamically

11. adding controls dynamically

12. Add Row dynamically to the beginning of datatable in a datagrid

 

 
Powered by phpBB® Forum Software