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
My 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)
{
//this function is raised twice, i was expecting that this will not be raised
}