VB6/VBA TabStrip Can Have Same Controls In Both Tabs?
vb6, vb6-migration, vba
Solution
In VB6 the TabStrip control isn't a container, it just underlays whatever container – most commonly a picturebox – one places over its panel area. So the same controls could be used for each tab and just change label captions and/or data sources to update them.
In VB.NET the TabControl provides a panel-like object called a TabPage for each tab. So you can either place separate controls on each page at design time or, to simulate the VB6 method, programmatically move controls between the pages by changing their 'Parent' property at runtime. This would typically be done in the TabControl's SelectedIndexChanged event, like so:
Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
DataGridView1.Parent = TabControl1.SelectedTab
End Sub
Problem
I have noticed that the VBA/VB6 TabStrip control allows for clones instances of its children within its pages. I am looking at an old VBA project that has a tabstrip, and behind-the-scenes it just adds pages, and the controls are automatically copied, but can have different data sources. Any way to replicate this in VB.NET?