How to create a tab control with a dynamic number of tabs in Visual Studio C#?
I\'ve got a database with a table customers
. I need to create a form that
You can generate dynamic tabs with the existing TabControl. Here is an example of how it can be done in a somewhat sort of pseudo code form...
TabControl tabControl = new TabControl();
tabControl.Dock = DockStyle.Fill;
foreach (Char c in lastNameList)
{
TabPage tabPage = new TabPage();
tabPage.Text = c.ToString();
DataGrid grid = new DataGrid();
grid.Dock = DockStyle.Fill;
grid.DataSource = dataForTheCurrentLoop;
tabPage.Controls.Add(grid);
tabControl.Controls.Add(tabPage);
}
this.Controls.Add(tabControl);