我正在用 C# 创建一个 Windows 应用程序,
我有 1 个 Datagridview,在我将它设置为 DataSource 后它应该有 3 行。
我已将 2 个事件处理程序附加到 Datagrdview
void dgvProductList_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)<br>
{
//this gets called 4 times
}
private void dgvProductList_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
//gets called 2 times.
}
为什么会发生这种情况,我该如何解决?
提前致谢...
最佳答案
From msdn online DataBindingComplete Event
This event is raised when the contents of the data source change or when the value of the DataSource, DataMember, or BindingContext property changes.
例如如果您要分配数据源,然后添加 3 行 --> 触发 4 次事件
关于c# - DataBindingComplete 被多次调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/828505/