问题描述:

I use BindingNavigator1 that has ADD ROW / DELETE ROW buttons. However, I want to make my own bigger button with hotkey alt+a.

How to call BindingNavigator1. AddNewItem button from my button / or make hotkey for it? There is no existing method..

网友答案:

The BindingNavigator is just a graphical interface to the BindingSource component. You should call AddNew directly on the BindingSource itself, not through the BindingNavigator. Assuming that the BindingSource property of the BindingNavigator is set to theBindingSource, you should do that :

Private Sub MyOwnBiggerAddButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles MyOwnBiggerAddButton.Click
    theBindingSource.AddNew()
End Sub

It is exactly equivalent to clicking the AddNewItem button on the BindingNavigator.

相关阅读:
Top