本文介绍了DataBindingComplete被多次调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在c#中创建一个Windows应用程序,我有1个Datagridview,在我设置它的DataSource之后,它应该有3行。
我已将2个事件Habdlers附加到Datagrdview
void dgvProductList_RowsAdded(object sender,DataGridViewRowsAddedEventArgs e) < br>
{
//这被称为4次
}
private void dgvProductList_DataBindingComplete(object sender,DataGridViewBindingCompleteEventArgs e)
{
//被叫2次。
}
为什么这会发生,我该如何解决?
感谢提前...
解决方案
例如如果您分配Datasource,然后添加3行 - > 4次事件触发
I am creating a windows application in c#,
I have 1 Datagridview and after I set it's DataSource it should have 3 Rows.
I have attached 2 Event Habdlers to the 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.
}
Why does this Happen and how would I fix it?
Thanks In Advance...
解决方案
From msdn online DataBindingComplete Event
E.g. If you are assigning Datasource, and then adding 3 rows --> 4 times event fired
这篇关于DataBindingComplete被多次调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!