Question

I need to open my Form in XtraTabControl. Help me how to open Forms on Tab Control ? Normally I open Forms in Panel Control I used

        panelControl1.Controls.Clear();
        var myForm = new NewForm();
        myForm.TopLevel = false;
        myForm.AutoScroll = true;
        panelControl1.Controls.Add(myForm);
        myForm.Show();

this code work for Panel Control but I need code to open form in Tab Control. Help me Thanks in Advance.

Was it helpful?

Solution

You easily can use the DevExpress UserControl. Make a class which extends from UserControl (you can also use Designer for it). Then your TabControl needs different TabPages which are your container. Then you can add your Form (UserControl) to the TabPage in same way like Panel.

To close a tab you can easily change the tab page to another one (which is empty or got other usercontrol). If the user should not come back you can use the visibility of each TabPage or the enable Property to handle this.

OTHER TIPS

Create a new TabItem, add the new form to the created TabItem and finally add the TabItem to the TabControl.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top