Home > database >  TabControl (SelectedTab) does not work, how can I fix this?
TabControl (SelectedTab) does not work, how can I fix this?

Time:02-04

I am working on a Project in the Moment and have a Problem with the selection of a Tab in TabControll. I tried to select a Tab with TabControl.SelectedTab, but then an error appears that says, that SelectedTab does not exists. Is there anything I am missing? Down below is the Code how I tried to select a Tab.

TabControl tabControl1 = new TabControl();
tabControl1.SelectedTab = tabControl1.TabPages["tb_config"];

Thx for any help :)

CodePudding user response:

Ok I finally got the solution:

System.Windows.Forms.TabControl tabControl1 = new System.Windows.Forms.TabControl();
                         
this.tabControl1.SelectedIndex = 2;

If I use this Code, it works without Problems :)

  •  Tags:  
  • Related