更新时间:2023-12-05 11:49:34
尝试 BindingSource.AddNew方法 [ ^ ]。
已解决 - 我发现另一个线程有一个类似的问题。当您添加bindingNavigator时,Visual Studio将自行添加一些代码。通常,当用户单击bindingNavigatorAddItem按钮时,除了您添加的任何代码之外,还会触发此代码,从而为您提供越界记录索引。在InitializeComponent过程中,我找到并禁用该行
Me.BindingNavigator1.AddNewItem = Me.BindingNavigatorAddNewItem
这样做解决了我的问题。
Solved - I found another thread with a similar problem. When you add the bindingNavigator Visual Studio will add some code on its own. Normally, when a user clicks the bindingNavigatorAddItem button this code is fired in addition to any code you add giving you an out-of-bounds record index. In the InitializeComponent procedure I located and disabled the line
Me.BindingNavigator1.AddNewItem = Me.BindingNavigatorAddNewItem
Doing so resolved my problem.
已解决 - 我发现了另一个类似问题的线程。当您添加bindingNavigator时,Visual Studio将自行添加一些代码。通常,当用户单击bindingNavigatorAddItem按钮时,除了您添加的任何代码之外,还会触发此代码,从而为您提供越界记录索引。在InitializeComponent过程中,我找到并禁用该行
Me.BindingNavigator1.AddNewItem = Me.BindingNavigatorAddNewItem
这样做解决了我的问题。
Solved - I found another thread with a similar problem. When you add the bindingNavigator Visual Studio will add some code on its own. Normally, when a user clicks the bindingNavigatorAddItem button this code is fired in addition to any code you add giving you an out-of-bounds record index. In the InitializeComponent procedure I located and disabled the line
Me.BindingNavigator1.AddNewItem = Me.BindingNavigatorAddNewItem
Doing so resolved my problem.