0

How can I disable only one TabPage that is embedded in a TabControl. This has only two TabControl TabPage's but a TabPage does not have the property tabPage.Enabled = true;

Renan Barbosa
  • 1,046
  • 3
  • 11
  • 31
  • possible duplicate of [How to hide TabPage from TabControl](http://stackoverflow.com/questions/552579/how-to-hide-tabpage-from-tabcontrol) – Dmitry Apr 04 '14 at 00:19
  • He's not asking to remove or hide a TabPage. he's asking to disable it. It's not possible directly but there are alternatives. see these . http://stackoverflow.com/questions/418006/how-can-i-disable-a-tab-inside-a-tabcontrol and http://social.msdn.microsoft.com/Forums/en-US/985b41c3-a1de-4744-8875-63262d4c2718/tabcontrol-disableenable-tab-page?forum=winforms – Sam Apr 04 '14 at 00:26
  • I don't know why but `.Enabled` property is suppressed for code editor. But, it doesn't mean you can't use it. try `tabPage.Enabled = False;` it will not give any error. – Shell Apr 04 '14 at 04:14

1 Answers1

0

I implemented the following solution.

//Disable tabPage1
Control ctrl = (Control)tabPage1;
ctrl.Enabled = false;

//Select tabPage2
tabControlMain.SelectedTab = tabPage2;
Renan Barbosa
  • 1,046
  • 3
  • 11
  • 31
  • I took this implementation from http://stackoverflow.com/questions/418006/how-can-i-disable-a-tab-inside-a-tabcontrol denoted by Sam. Thanks! – Renan Barbosa Apr 04 '14 at 01:03