Click here to Skip to main content
14,266,228 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am trying to display the text of a textBox inside a MessageBox. There are no error messages at all. The contents of the TextBox simply don't appear in the MessageBox (first MessageBox in the code). Can you please take a look at it and tell me what's wrong? I really appreciate it. Thank you! Best regards. :)

What I have tried:

private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
{
    if (MessageBox.Show("Tem certeza que deseja excluir o pagamento " + cod_caixaTextBox.Text, "Atenção", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
    {
        this.caixaBindingSource.EndEdit();
        this.tableAdapterManager.UpdateAll(this.bremingtonBackEndDataSet);
        MessageBox.Show("Pagamento excluido com sucesso!", "Pronto ...", MessageBoxButtons.OK);
    }
    else
    {
        caixaBindingSource.CancelEdit();
        this.caixaTableAdapter.Fill(this.bremingtonBackEndDataSet.caixa);
    }
}
Posted
Updated 13-Oct-16 17:23pm
v2
Comments
Philippe Mori 13-Oct-16 23:08pm
   
What is not working... And what have you tried? Obviously with so little information it is hard to help you?

Have you tried to debug that code? Do you see a message box or not?
JC Carmo 13-Oct-16 23:10pm
   
There are no error messages at all. The contents of cod_caixaTextBox simply don't appear in the MessageBox.
Rate this:
Please Sign up or sign in to vote.

Solution 1

I found what the problems is: the reason why the contents of the TextBox are not displayed in the MessageBox is because when I click on the BindingNavigatorDeleteItem, it deletes the record without confirmation, thus the MessageBox can't display the TextBox.Text because it has been deleted. Now I have to find a way to add the confirmation BEFORE the BindingNavigatorDeleteItem deletes the record. Any ideas?
   
v4
Rate this:
Please Sign up or sign in to vote.

Solution 2

SUCCESS!!! All I needed to do was set the DeleteItem property of the binding navigator no NONE so I could handle the event manually.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100