How to identify which Tabpage is being closed

0
Have a good day, how are you? I'm working with XtraTabControl, and when I close a tab, I need to know which tab was closed. today in the xtraTabControl1_CloseButtonClick event, I'm doing it as follows:

'

private void xtraTabControl1_CloseButtonClick(object sender, EventArgs e) //click fechar aba 
        {
            ClosePageButtonEventArgs arg = e as ClosePageButtonEventArgs;
            (arg.Page as XtraTabPage).PageVisible = false;

        if (//CONDIÇÂO SOMENTE PARA A PAGE 1) // so executa se for a aba 1
        {
            foreach (Control ctl in xtraTabPage1.Controls)
            {
                if (ctl is TextEdit)
                {
                    ((TextEdit)(ctl)).Text = string.Empty;
                }

                if (ctl is TextBox)
                {
                    ((TextBox)(ctl)).Text = string.Empty;
                }
            }

            id_v = 0;
            gridControl2.DataSource = null;
            gridView2.Columns.Clear();
            gridView1.ActiveFilterString = "";
        }
    }'

Can anyone help me with the condition of the IF?

Thanks

    
asked by anonymous 20.07.2016 / 14:04

1 answer

0

I got it,

I made the condition as follows:

arg.Page == xtraTabPage1

Final code:

private void xtraTabControl1_CloseButtonClick(object sender, EventArgs e) //click fechar aba 
    {
        ClosePageButtonEventArgs arg = e as ClosePageButtonEventArgs;
        (arg.Page as XtraTabPage).PageVisible = false;

        if (arg.Page == xtraTabPage1) // so executa se for a aba um
        {
            foreach (Control ctl in xtraTabPage1.Controls)
            {
                if (ctl is TextEdit)
                {
                    ((TextEdit)(ctl)).Text = string.Empty;
                }

                if (ctl is TextBox)
                {
                    ((TextBox)(ctl)).Text = string.Empty;
                }
            }

            id_v = 0;
            gridControl2.DataSource = null;
            gridView2.Columns.Clear();
            gridView1.ActiveFilterString = "";
        }
    }

Thanks

    
20.07.2016 / 14:13