0
votes

In my form I have a TabControl container. Is there a way to place a button that looks like a tab itself on the right side of the already existing tabs? Furthermore the behaviour of the button has to be dynamic (move to the right as new tabs get added, move to the left as existing tabs are deleted).

Thanks in advance.

1

1 Answers

1
votes

define class variable

TabPage addTab=new TabPage("+");

then (in the from constructor after initialization, or in form load event) add this tab page to you tabcontroll

tabControll.TabPages.Add(addTab);

then in SelectedIndexChanged event of your tabccontroll

if (tabControll.SelectedTab==addTab){
     var index=tabControll.TabPages.Count-1;
     var myNewTab=new TabPage("title");
     //what ever you want to do with the tab
     tabControll.TabPages.Insert(index,myNewTab);
     tabControll.SelectedTab=myNewTab;
}