Comobox event SelectedValueChanged
Posted
by IordanTanev
on Stack Overflow
See other posts from Stack Overflow
or by IordanTanev
Published on 2010-05-08T06:50:54Z
Indexed on
2010/05/08
6:58 UTC
Read the original article
Hit count: 242
Hi,
i have simple question may be someone asked it before me but i could not find it.Let say i have datatable that has some data from the database and i want to bind it to a combobox i use standart code like this
comboBox1.BeginUpdate( );
comboBox1.ValueMember = "id";
comboBox1.DisplayMember = "name";
comboBox1.DataSource = dt;
comboBox1.EndUpdate( );
The problem is during this binding the event SelectedValueChanged
is fired.The problem is that rebind combo several times when outher values change and every time i must do sometihn like this
comboBox1.SelectedIndexChanged -= new System.EventHandler( this.comboBox1_SelectedValueChanged );
my question is there a smarter way to skip the event when i comes from databinding not from user input.The problem is that i want to do it some how globaly in my control that inherits combobox and not to do it everytime in every from
Best Regards,
Iordand
© Stack Overflow or respective owner