tags:

views:

73

answers:

3

Hi, I have developed an application in windows forms.but now i was told to put the same in a tabbedpage.the problem I'm facing is how can i insert forms in a tabbed control .and if this is not possible,then what can i do .i need to navigate between the pages(or forms)and data shud be persistent while navigation.

is there any way to insert forms in tab control? even if it is possible the form shouldn't look like a form rather it should like a page. please help me

thanks in advance sri.

+1  A: 

Try making a UserControl with all the logic and forms from your first application and use it in by dropping it on your main form on your second application.

Making the UserControl shouldn't be that hard, you could copy-paste the controls from your old app.

Not sure if this is of any help but I hope it does.

tzup
A: 

Hey guys got it!!!

form1.TopLevel = false; form1.FormBorderStyle = FormBorderStyle.None;//this is not compulsary this.tabPage1.Controls.Add(form1); form1.Show();

thanks! srini

srinivas
A: 

OK, the guy above me is right but there is a slight clarification. You are adding the control to a TabPage not to a TabControl. He writes it right but I interpreted it wrong. Do not try to add this in the designer code, any change will break the order and it will not work. Just add this to the Form.Load event.

Friend WithEvents panelForm1 As panelForm

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            '
            'panelForm1
            '
            Me.panelForm1 = New ValidZoneExtracurricularTasks.SyncForm
            Me.panelForm1.ClientSize = New System.Drawing.Size(673, 228)
            Me.panelForm1.Dock = System.Windows.Forms.DockStyle.Fill
            Me.panelForm1.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
            Me.panelForm1.Location = New System.Drawing.Point(3, 3)
            Me.panelForm1.Name = "panelForm1"
            Me.panelForm1.Text = "panelForm1"
            Me.panelForm1.Visible = False
            Me.panelForm1.Dock = DockStyle.Fill
            Me.panelForm1.TopLevel = False

            Me.tpgSync.Controls.Add(Me.SyncForm1)
            Me.SyncForm1.Show()
        Catch ex As Exception

        End Try
    End Sub

THis should help you, userControls if you are going to try it read on them because they are not that easy to use.

ThorDivDev