C# TabControl - is it possible to "disable" individual TabPages?

Posted by CaldonCZE on Stack Overflow See other posts from Stack Overflow or by CaldonCZE
Published on 2010-06-10T11:52:59Z Indexed on 2010/06/10 12:22 UTC
Read the original article Hit count: 199

Filed under:
|
|

Is it somehow possible to disable one (or more) tabs of tab control? At some point I need to make user stay on the active tab and prevent him from leaving... I know I can disable the whole TabControl component, but that disables also all components on active tab...

I also tried to use the Selecting method of TabControl:

private void TabControl_Selecting(object sender, TabControlCancelEventArgs e) {           
    e.Cancel = PreventTabSwitch;
}

This works, prevents user from switching (if PreventTabSwitch==true), but since all tabs look active and just don't react it's confusing...

There is no Enabled property for individual tab pages, so I don't know what else to do...

Thanks a lot for in advance for all tips.

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms