How to update textbox from another WPF window

Asked

Viewed 143 times

0

I have 2 windows wpf (C#)

To register B search engine provider

Inside the window A to a textbox and a button that opens the window B, Inside the window B has a textbox and a button.

How do I move to window A (which is open), the contents of the Window B textbox (which is also open) without having to reopen window A.

My class from window B

   //IGNORE - Aqui consigo pegar o conteudo vinda da janela A
    public BFuncio_Clientes_Fornec(ContasaPagarCadastrar contasaPagarCadastrar)
    {

        InitializeComponent();
       //IGNORE Aqui consigo pegar a informação da janela A e colocar na B
        termobusca.Text = contasaPagarCadastrar.pagante.Text;

    }
    //AQUI É O EVENTO AO MUDAR DE FOCO NO BOTAO DA JANELA B
    private void Seleciona_LostFocus_1(object sender, RoutedEventArgs e)
    {
        //AQUI SERIA UTILIZADO PARA SETAR O CONTEUDO NA CLASS DA JANELA A
        ContasaPagarCadastrar novopagante = new ContasaPagarCadastrar();
        novopagante.pagante.Text = termobusca.Text;
        //AQUI SERIA PARA ABRIR UMA NOVA JANELA A
       //MAIS EU NAO QUERO ABRIR, QUERO SÓ ATUALIZAR O TEXTBOX DA JANELA JÁ ABERTA A
        novopagante.Show();
    }
  • 1

    is actually duplicated from another question related to WPF and not Windows Forms.. In the case of that https://answall.com/questions/262808/howto clean_textbox-de-other-window-wpf/262826#262826

  • I hadn’t voted to close as duplicate... but in this case, it’s duplicate of this other issue that @Thiagoloureiro raised, not the one that is currently

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.