I have ComboBox control(WinForm project).
When I bind DataSource to the ComboBox control combobox_selectedindexchanged event is fired.
Any idea how to prevent selectedindexchanged event when DataSource is bound?
See Question&Answers more detail:osI have ComboBox control(WinForm project).
When I bind DataSource to the ComboBox control combobox_selectedindexchanged event is fired.
Any idea how to prevent selectedindexchanged event when DataSource is bound?
See Question&Answers more detail:osRemove the handler for the SelectedIndex_Changed event, bind your data, then add the handler back. Following is a simple example of how this might be done within a method:
private void LoadYourComboBox()
{
this.comboBox1.SelectedIndexChanged -= new EventHandler(comboBox1_SelectedIndexChanged);
// Set your bindings here . . .
this.comboBox1.SelectedIndexChanged += new EventHandler(comboBox1_SelectedIndexChanged);
}