Using TabControl Programmatically

If I have a standard TabControl element in the form view, how can I programmatically create a new tab with a button that contains predefined elements such as TextBox, Button, etc., or how can I configure Tab to load another form inside myself?

Is it possible?

+3
source share
2 answers

You can create a new tab by calling tabControl.TabPages.Add.

You can then add other controls to the collection TabPage Controls.

- , TabPage, , Fill.

:

var tabPage = tabControl.TabPages.Add("My Custom Tab");
var control = new MyCustomControl();
control.Dock = DockStyle.Fill;
//Set other properties if you want to.
tabPage.Controls.Add(control);
+6

Form TabPage.

, UserControl, UserControl , / .

+1

Source: https://habr.com/ru/post/1733594/


All Articles