Articles in this section
Category / Section

How to retrieve the selected state of a tab page in WinForms TabControlAdv?

1 min read

Retrieve the selected state of tab page

In TabControlAdv, it is possible to retrieve the selected state of a TabPageAdv. This article demonstrates the steps to retrieve the selected state of tab pages. The steps are,

1. Create a custom control inherited from the TabPageAdv.

2. Implement a Boolean property named IsSelected that holds selected state of TabPageAdv.

3. Return IsSelected property value by comparing the SelectedTab property of TabControlExt with the instance of page.

C#

/// <summary>
/// Class that Extends TabPageAdv
/// </summary>
public class TabPageExt : TabPageAdv
 
/// <summary>
/// Gets whether the Tab is Selected
/// </summary>
public bool IsSelected
{
    get 
    {
        if(this.Parent is TabControlAdv)
        {
            if((this.Parent as TabControlAdv).SelectedTab == this)
            {
               return true;
            }
        }
        return false;
    }
}

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied