Tab Controls  
Author Message
Duncan McC





PostPosted: Visual C# General, Tab Controls Top

Can someone let me know how i can add a TAB CONTROL to an existing windows form application

Visual C#10  
 
 
Enormity





PostPosted: Visual C# General, Tab Controls Top

Inserting a tab control, and moving your items into it would really be the easiest way to go. You would place the tab control into your existing form, then select all (deselecting the tab control) and move it into the first tab of the form. No coding changes would need to be done.

The hard way would be to place buttons at the top of the form (your new tabs) and place everything else currently on the form into a group box. Set all the buttons flatstyle to 'PopUp' (other than the first button) and make sure the first button is in front, and each button is a little overlapping (to make it look like tabs). Then insert something like...

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

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Button1.FlatStyle = FlatStyle.Standard

Button2.FlatStyle = FlatStyle.Popup

Button1.BringToFront()

GroupBox1.Show()

GroupBox2.Hide()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Button1.FlatStyle = FlatStyle.Popup

Button2.FlatStyle = FlatStyle.Standard

Button2.BringToFront()

GroupBox2.Show()

GroupBox1.Hide()

End Sub

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

This would cause a tabbed-like action. Though, this is a lot more work than just placing your existing content into a tab control. If I misunderstood the question, or for more info, please let me know. I hope this helps, even if just a little.


 
 
rlnd





PostPosted: Visual C# General, Tab Controls Top

You can simply drag'n'drop it from the VS toolbar ...

Greets


 
 
Duncan McC





PostPosted: Visual C# General, Tab Controls Top

You can drag and drop it to create a new form, but that means starting again with designing form and everything.

I am try to avoid that and just add it into the existing form.


 
 
rlnd





PostPosted: Visual C# General, Tab Controls Top

So, you want to add an existing TabControl to a form You should create a UserControl (and design the TabControl here) and then add the UserControl to any form you want to host the control. Or copy and paste it ;-)


 
 
Duncan McC





PostPosted: Visual C# General, Tab Controls Top

I don't think so as its not an existing tab control just an existing single page form.

Looking to add a second page to the form and a tab control to switch between them. So tab control would be new one i think, unless i'm missing something.


 
 
rlnd





PostPosted: Visual C# General, Tab Controls Top

Ok:

1. Add the TabControl - it contains two TabPages by default
2. Edit the TabPages' names via the property window of VS
3. Design the TabPages

 
 
Sabrecat





PostPosted: Visual C# General, Tab Controls Top

First off make sure you have a good back up of your project. Select everything on your main form. Cut it all. Add your Tab control, and paste all the controls you just cut into the tab page. If your Tab control was set to dock type of Fill you should have the exact same layout as was on your form.