how disable the items in the tabcontrol

C

Claudia Fong

Hi,

I added a tabcontrol in a panel in my form.

My tabcontrol have more than 3 pages.. each page contains textboxes,
combobox, checkbox.

I want to disable the items of each of the page of the tabcontrol (so
that the user won't be able to change the values in the textboxes,
combobox, checkbox) without the tabcontrol turn into grey.

If I use the enable property the whole tab will turn into grey.. someone
told me to disable the panel instead of the tabcontrol, but the result
is the same.. the tabcobtrol turn grey..

Does someone know any trick?

Cheers!

Claudi
 
I

Ignacio Machin ( .NET/ C# MVP )

Hi,

I added a tabcontrol in a panel in my form.

My tabcontrol have more than 3 pages.. each page contains textboxes,
combobox, checkbox.

I want to disable the items of each of the page of the tabcontrol (so
that the user won't be able to change the values in the textboxes,
combobox, checkbox) without the tabcontrol turn into grey.

If I use the enable property the whole tab will turn into grey.. someone
told me to disable the panel instead of the tabcontrol, but the result
is the same.. the tabcobtrol turn grey..

Does someone know any trick?

Cheers!

    Claudi

*** Sent via Developersdexhttp://www.developersdex.com***

If you put all yours tabPage's controls inside a Panel then you only
hve to disable the panel
You will end with somethig like:
TabControl
TabPage
Panel (or GroupBox)
all your controls.
 
K

kyle.szklenski

Offhand, I can think of a pretty simple way to do this:

foreach (Control c in tabControl1.TabPages[0].Controls)
{
c.Enabled = false;
}

Obviously, instead of TabPages[0], you would just want to do whatever
the current TabPage is. I tested this and it worked, and is fairly
simple.

Kyle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top