VB.NET create tabcontrol pages

0

I have a form1 called NativeMethods with 1 tabcontrol1 and 1 tab in that tabcontrol1.

On the other hand, I have a button:

Private Sub Button7_Click_1(sender As Object, e As EventArgs) Handles Button7.Click
    Dim frmNewForm As New NativeMethods
    Dim NewTab As TabPage = frmNewForm.TabPage1
    NewTab.Text = TabControl1.TabCount + 1.ToString
    TabControl1.TabPages.Add(NewTab)
End Sub

That is responsible for creating another tab in that tabcontrol1 copying the existing one.

So far so good, but when I try to do the process to add a third window, nothing happens.

Reviewing my code I suppose that the third window is not being created because it has already been created when generating the second one, so it detects them repeatedly.

Any ideas for this to work, being able to add several windows?

    
asked by Adrian Hernando Solanas 25.06.2018 в 17:53
source

0 answers