C# Applications - TabControl contains Multiple UserControls

Answered C# Applications - TabControl contains Multiple UserControls

  • 14 aprilie 2012 09:49
     
     

    I am looking for some c# Desktop Application example coding for the following

    ------------------------------------------------------------------------------------------------------

    One Tabcontrol contains multiple user controls which is loading up dynamically

    For example,

    MyContainerForm.cs  (just a Windows Form with a tab control contains 5 tab pages)
    UserControl1.cs (it has a button and a datagrid control)
    UserControl2.cs (it has several textboxes)
    UserControl3.cs (it has several textboxes and couple combox)
    UserControl4.cs (it has one listview control)
    UserControl5.cs (it has one listview control and one textbox)
     
    I just want to know how to do the coding loading up to MyContainerForm.cs

    Thanks for your time ~

Toate mesajele

  • 14 aprilie 2012 09:56
     
     Răspuns Are cod

    Hi,

    for adding your usercontrols to your MyContainerForm you can use code like this:

    MyContainerForm container = New MyContainerForm();
    UserControl1 usrCtrl1 = New UserControl1();
    container.Controls.Add(usrCtrl1);


    Hannes

    If you have got questions about this, just ask.

    In a perfect world,
    users would never enter data in the wrong form,
    files they choose to open would always exist
    and code would never have bugs.

    C# to VB.NET: http://www.developerfusion.com/tools/convert/csharp-to-vb/