I'm using Visual Basic 9 (VS2008)
I want to create new Tabs as and when the user clicks an Add Tab button.
The Tab must have a ListView control docked inside it.
How to programmatically add a Tab to TabControl with a ListView control docked inside it?
It will go something like this...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
// Create the listView
Dim lstView As New ListView()
lstView.Dock = DockStyle.Fill
lstView.Items.Add("item 1") //item added for test
lstView.Items.Add("item 2") //item added for test
// Create the new tab page
Dim tab As New TabPage("next tab")
tab.Controls.Add(lstView) // Add the listview to the tab page
// Add the tabpage to the existing TabCrontrol
Me.TabControl1.TabPages.Add(tab)
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.