SelectedIndexChanged is firing twice for a ListView
Posted on 2006-06-23
I need to be notified when the user changes a ListView selection. Am I handling the right event?
The event gets fired twice for some reason, and I can't find the problem. So I thought I'd be smart and use a boolean variable to call my code once, but not the second time. The code commented out shows my failed attempt to hack a solution.
private bool intializingDeliveryRun = true;
private void driverRunsLV_SelectedIndexChanged(object sender, System.EventArgs e)
//if ( intializingDeliveryRun )
addressListBox.SelectedIndex = -1;
intializingDeliveryRun = false;
intializingDeliveryRun = true;