DataGridView's SelectionChange event firing more than once on DataBinding

Posted by Shantanu Gupta on Stack Overflow See other posts from Stack Overflow or by Shantanu Gupta
Published on 2010-06-03T15:33:35Z Indexed on 2010/06/03 15:54 UTC
Read the original article Hit count: 253

Filed under:
|
|
|
|

This Code triggers selection change event twice. how can I prevent it ? Currently i m using a flag or focused property to prevent this. But what is the actual way ?

I am using it on winfoms

EDIT

Mistake in writing Question, here is the correct code that i wanted to ask

private void frmGuestInfo_Load(object sender, EventArgs e)
{
this.dgvGuestInfo.SelectionChanged -= new System.EventHandler(this.dgvGuestInfo_SelectionChanged);
dgvGuestInfo.DataSource=dsFillControls.Tables["tblName"];
this.dgvGuestInfo.SelectionChanged += new System.EventHandler(this.dgvGuestInfo_SelectionChanged);
}

private void dgvGuestInfo_SelectionChanged(object sender, EventArgs e)
{

}

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET