Hi,
Can anybody help me, I have an tabcontrol which has dynamically added the tabpages now i want to add datagridview controls in each tab pages how i can do this.I am written the code like

For i = TabControl1.TabPages.Count - 1 To 0 Step -1
            Dim dtg As New DataGridView
            TabControl1.TabPages(i).Controls.Add(dtg)
        Next

But it only works for count=1.
Thanks in advance.............

Hi, i am figure out this thread by using following code...

Dim tabPage As TabPage = New TabPage
            tabPage.Text = "Paper " & k
            Dim grid As DataGridView = New DataGridView
            grid.Dock = DockStyle.Fill
            tabPage.Controls.Add(grid)
            TabControl1.Controls.Add(tabPage)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.