Tab Controls RRS feed

  • Question

  • I have a working Form using Visual Studio.

    I now need to add a second form and need to insert a Tab Control.

    The only way i can see of doing it is to create a tab control and start over - clearly this is an option i don't want to take up.

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

    Wednesday, January 17, 2007 10:46 AM


  • 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




    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




    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.

    Wednesday, January 17, 2007 8:49 PM