this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...

Tuesday, August 10, 2010

Hide Tab Pages from Tab Control in Win forms

Recently I come to know one requirement to hide tab pages on my tab control of windows form depends on some condition.

I thought there could be some properties like Visible as we have in other controls. But surprisingly there is no such properties exist.

At the end I have only one solution to remove my tabpage from tab control. Let’s go through some code.

I have following tabControls.

myTabControl is my Tab Controls and I have following sub tabs(tab Pages) in it.




At index of 0, 1 and 2 respectively.

To hide my tabPage1 on my UI I have following options.




I hope this could be helpful when we have some condition for showing tabs.