TabControl DevComponents

2

I am working on a Windows Forms app, at the moment of selecting the tab by means of a If I want it to fulfill a condition, but I have not achieved it I have tried with this code:

private void tabControlCategoriaSubCategoria_SelectedTabChanged(object sender, DevComponents.DotNetBar.TabStripTabChangedEventArgs e)
    {
        if (tabCPCategoria.TabIndex == 1)
        {
            EventHandler handler = DGVCategoria;
            if (handler != null) handler(this, e);
        }
        if (tabCPCategoria.TabIndex == 2)
        {
            EventHandler handler = DGVSubCategoria;
            if (handler != null) handler(this, e);
        }
    }

I've also tried this one:

private void tabControlCategoriaSubCategoria_SelectedTabChanged(object sender, DevComponents.DotNetBar.TabStripTabChangedEventArgs e)
    {
        if (tabCPCategoria.TabItem == tabItem1)
        {
            EventHandler handler = DGVCategoria;
            if (handler != null) handler(this, e);
        }
        if (tabCPCategoria.TabItem == tabItem2)
        {
            EventHandler handler = DGVSubCategoria;
            if (handler != null) handler(this, e);
        }
    }

It has not worked for me, in other versions I've done it with SelectecTab but now it does not have that property.

    
asked by Pedro Ávila 22.05.2016 в 16:48
source

1 answer

1

I already solved it.

if (tabControlCategoriaSubCategoria.SelectedTab == tabItem1)
        {
            EventHandler handler = DGVCategoria;
            if (handler != null) handler(this, e);
        }
if (tabControlCategoriaSubCategoria.SelectedTab == tabItem2)
        {
            EventHandler handler = DGVSubCategoria;
            if (handler != null) handler(this, e);
        }
    
answered by 22.05.2016 / 17:43
source