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

Friday, November 28, 2008

How to disable PageTab?

Many times we have requirement that, we have more than one tab pages and we want to disable other tab untill we complete work on a tab.

To simple answer to this situation is NO as there is no property to disable tabpage.

You can use third party control to do this.

Other solution for this is to disable all controls on that tab page. We can achieve this with the help of follwoing code snippest ..

 For Each tab As Control In Me.tabMain.Controls
                Dim c As TabPage = TryCast(tab, TabPage)
                If Not c Is Nothing Then
                    tab.Enabled = False
                End If
            Next

Above code we can put on TabSelectedIndexChange event, and can disable or enable.
Please let you know that you can able to select tab but all control on that is disabled so you can not do anything.

No comments: