textbox value for another textbo using Tabcontrol and Tabpages

1

I'm using a form with a TabControl , with three pages.

In% with% I have a TabPage1 (seller), I need to take the value of this TextBox to another TextBox that is in TextBox .

How can I do this between the TabControl pages where the form is unique?

Here is the TabPage3 of the form:

private void frmComissaoPic_Load(object sender, EventArgs e)
{
    SqlCommand carrega = new SqlCommand(@"SELECT SA.A3_NREDUZ FROM SA3010 AS SA WHERE SA.A3_TIPO = 'E'", conexaoDADOADV(true));
    carrega.Connection = conex;
    carrega.CommandType = CommandType.Text;
    try
    {
        SqlDataReader dr = carrega.ExecuteReader();
        DataTable dt = new DataTable();
        dt.Load(dr);

        txt_vendedor.DisplayMember = "A3_NREDUZ";
        txt_vendedor.DataSource = dt;
    }
    catch (Exception)
    {
        MessageBox.Show("Não existem dados a retornar por favor verifique como o Administrador do sistema");
    }

    CloseButtonDisabler.DisableCloseButton(this.Handle.ToInt32());

    txt_vendatab3.Text = txt_vendedor.Text;            
    txt_nfe.Text      = "";
    txt_pedido.Text   = "";
    txt_item.Text     = "";
}
    
asked by anonymous 31.10.2017 / 18:35

1 answer

2

Just use the event Selecting of TabControl

public void tabControl1_Selecting(object sender, TabControlCancelEventArgs e)
{
    txtDois.Text = txt_vendedor.Text;
    // Onde, txtDois é o TextBox que vai receber este dado
}

You can enter the event using the form designer or on the (or after) method InitializeComponents()

public Form1()
{
    InitializeComponents();
    tabControl1.Selecting += tabControl1_Selecting;
}
    
31.10.2017 / 18:58