There is code for save button, but I can't see any code behind the Add button though the button works ?
So what would it be as I want to create my own not from scratch ?
Thanks.
The way the add button wires up, is to the underlying type or BindingSource. Based on the behavior I saw yesterday, if the underlying list was bound to a type that had an empty constructor it was enabled, if not, the button was disabled. So it should be
this.bindingNavigator1.BindingSource.AddNew();
this.bindingNavigator1.BindingSource.MoveLast();
if you have something where you don't want the default constructor use something like this:
this.bindingNavigator1.BindingSource.Add(new T(1));
this.bindingNavigator1.BindingSource.MoveLast();
The save code would be as such:
If you are using a strongly typed dataset the code would be like
DataSet.AcceptChanges();
or if using tableAdapters
var myTableAdapter=new DataSet1TableAdapters.assetTableAdapter();
myTableAdapter.Update(DataSet);
You may not be getting many views on a holiday/weekend.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With