DataBindingComplete is called multiple times

I am building a windows application in C #,

I have 1 Datagridview, and after I set its DataSource, it should have 3 rows.

I attached 2 Event Habdlers to 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 is this happening and how can I fix it?

Thanks in advance...

+5
source share
2 answers

From msdn online Event DataBindingComplete

This event occurs when the content of the data source changes or when the value is DataSource , DataMember or BindingContext .

. Datasource, 3 → 4

+6

, , DataSource. , DataSource, DataBind, DataBind DataGridView, , 4.

...

, : DataBind(), DataSource() .. , .

, , DataBind , , - databinds... ... .

0

All Articles