Where is the code behind the Add button for Winform BindingNavigator Control?

Is there a code for the Save button, but I don’t see the code behind the Add button, although the button works?

So, what would it be, how do I want to create my own not from scratch?

Thanks.

+3
source share
2 answers

The way to connect the add button to the base type or BindingSource. Based on the behavior that I saw yesterday, if the base list was bound to a type with an empty constructor, it was enabled, and if not, the button was disabled. So what it should be

this.bindingNavigator1.BindingSource.AddNew();
this.bindingNavigator1.BindingSource.MoveLast();

if you have something where you don't want the default constructor to use something like this:

this.bindingNavigator1.BindingSource.Add(new T(1));
this.bindingNavigator1.BindingSource.MoveLast();

The save code will be like this:

,

DataSet.AcceptChanges();

tableAdapters

var myTableAdapter=new DataSet1TableAdapters.assetTableAdapter();
myTableAdapter.Update(DataSet);

/.

+7

(linke BindingSource) BindingNavigator, Add , Move First, Next, Last, Previous, PoistionItem ( , ).

 bindingNavigator (bindingNavigatorAddNewItem), : 1. . 2. "" . (, ) 3. . .

"" , , "" "".

+2

Source: https://habr.com/ru/post/1714921/


All Articles