Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:

C#
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.

SUCCESS!!! All I needed to do was set the DeleteItem property of the binding navigator no NONE so I could handle the event manually.
 
Share this answer
 
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?
 
Share this answer
 
v4

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900