DataBindingComplete获取调用多次 [英] DataBindingComplete is getting called multiple times
问题描述
我创建在C#Windows应用程序,
我有1的DataGridView和我设置后的DataSource它应该有3行。
我附上2事件Habdlers到Datagrdview
无效dgvProductList_RowsAdded(对象发件人,DataGridViewRowsAddedEventArgs E) < BR>
{
//这个被调用4次
}
私人无效dgvProductList_DataBindingComplete(对象发件人,DataGridViewBindingCompleteEventArgs E)
{
//被调用2次。
}
为什么会出现这种情况,我会怎么解决?
在此先感谢...
的From MSDN联机DataBindingComplete事件
将引发此事件当数据源改变或在内容在数据源的值 数据成员或的BindingContext 属性的更改。
块引用>
块引用>
例如:如果您指定数据源,然后加入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
This event is raised when the contents of the data source change or when the value of the DataSource, DataMember, or BindingContext property changes.
E.g. If you are assigning Datasource, and then adding 3 rows --> 4 times event fired
这篇关于DataBindingComplete获取调用多次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!