hi am using a tab control. in which i have already 3 tabpages. now the problm is that when the form is loaded the first tabepage must be enable while other will be disable to access untill i press the button that first tabpage is contain.
is their solution for my problem. m waiting for reply.

Recommended Answers

All 2 Replies

You can't disable or hide tabpage in a tabcontrol only tabcontrol can be disabled. this is my problem also. my solution was remove the tabpages and add it again when i need them.

here what i did hope this may help you

private void button2_Click(object sender, EventArgs e)
        {
            if (tabControl1.TabPages.Contains(Secondtabpage))
            {
                return;
            }
            else
            {
                tabControl1.TabPages.Add(Secondtabpage);
            }
        }

when the form loads just remove the other tabs like
tabControl1.TabPages.Remove(Secondtabpage);
tabControl1.TabPages.Remove(Thirdtabpage);

so that the firsttab will be shown. use the above code to show your tabpages again.:

If you can use a free third party tabcontrol then take a look at
TabControlEX which does allow you to disable tabpages as well as a few other
things you can't usually do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.