Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
678 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...