Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Button on BindingNavigator does not work properly

Status
Not open for further replies.

likhtin

Programmer
Mar 31, 2006
8
Hi All

I am trying add to standart binding navigator some button. I add "Save" button. In event click it call method Save() of form

private void Save()

{

try

{

AppStart.setarithabort(this.tbAccountTableAdapter.Connection);

this.tbAccountTableAdapter.Update(this.dsInvestorAccount.tbAccount);

MessageBox.Show("Changes are saved");

}

catch (Exception ex)

{

MessageBox.Show("Error is happend. Please, let know programmer \n" + ex.Message);

}

}

If I call this method from button on form it works. if I call this method from button on Binding Navigator update of tabl does not happens, it shoes however message box. What do I do wrong?

Thanks in advance


 
That is the Point. NO exception. Code runs smoothly with one weird thing: line
this.tbAccountTableAdapter.Update(this.dsInvestorAccount.tbAccount);
simply does not work, does not affect anything, like it is not there.
 
After number of experiments and researches
Problem is that if method called from toolbar it requires validation of form and in same time simple buttton on form does not require it. Any thoughts why?
Anyway this is piece of working code
private void Save()

{

try

{

this.Validate();
AppStart.setarithabort(this.tbAccountTableAdapter.Connection);

this.tbAccountTableAdapter.Update(this.dsInvestorAccount.tbAccount);

MessageBox.Show("Changes are saved");

}

catch (Exception ex)

{

MessageBox.Show("Error is happend. Please, let know programmer \n" + ex.Message);

}

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top