Is there a way to disable a tab in a TabControl?
TabPages(4). Enabled = False where the TabPages(4) is the 5th in the TabControl collection. Your initial code should work if that is your intent. Substitute your own values for "UnselectableTab" and "TabControlName" for your project.
Cast your TabPage to a Control, then set the Enabled property to false.
((Control)this.tabPage).Enabled = false;
Therefore, the tabpage's header will still be enabled but its contents will be disabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With