Question

Say for instance I have a C# Winforms applciations that uses a tabcontrol with four different tab pages. Above this control on the main form are a series of groupboxes containing various buttons and textboxes relevant to the different functions running on each individual tabpage.

If I am using a particular tabpage that only makes use of some of the controls, I want to disable the others so that the user cannot accidentally click the wrong buttons.

Example Logic:

If(tabpage1.selected)   
{
   button3.Disabled();
}

Does anyone know of a way of implementing this kind of functionality?!

Regards,

EDIT:

Essentially I want to be able to disable groupboxes!!

Was it helpful?

Solution

Rather than calling .Disabled(), set the .Enabled property to false. To make this easier, you can put the related controls into the same container (Panel control), and just set Enabled to false for that container.

OTHER TIPS

button3.Enabled = false

Instead of:

if(tabpage1.selected)   
{
   button3.Disabled();
}

use:

buttom3.Enabled = !tabpage1.selected;
button3.Enabled = false;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top