Search code examples
c#eventscomboboxselectedvalue

ComboBox EditValue Assignment will fire selectedValueChanged event?


I have the code below: this.NameComboBox.EditValue = value; I find when value is not empty, it will automatically fire the event: NameComboBox_SelectedValueChanged

Acutally I replace the comboBox with my control in our project code, and due to my control doesn't have the selectedValueChanged event, so I use mycontrol_leave to replace this NameComboBox_SelectedValueChanged. All works fine but the only problem is the line of code "this.myControl.EditValue = value;" will not call mycontrol_leave automatically.

Shall I just add a condition after "this.NameComboBox.EditValue = value;": if value is not null or empty string myControl_leave;

Thanks!


Solution

  • You can fire the event mycontrol_leave in the setter of the property EditValue.