0

I have a Form and a tabcontrol with 2 tabs and a timer in it. I want to know how to disable click tab2 when Form load and enable it when a timer tick for amount of time.

I have tried tab2.Enabled = false;, it works fine but people still click and choose that tab (contents are disabled).

Thank you!

Sorry about my english!

Ok the solution is:

 private void tabControl1_Selecting(object sender, TabControlCancelEventArgs e)
{
    if (e.TabPage == tabPage2)
        e.Cancel = true;
}
tuankhoa1996
  • 131
  • 4
  • 18

1 Answers1

0

If you mean that you have an event handler for the tab's click event, you need to unhook it when the form initializes, something like this:

tab2.Click -= tab2_Click;

...and then hook it back up in the Timer's trip event something like this:

tab2.Click += tab2_Click;

Again, this assumes that you do have a tab2_Click(sender object, eventargs e) event handler defined already.

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862