Is it possible to change the order in which certain events are called? for instance, I have a ComboBox and when a selection is changed, I would like the SelectedIndexChanged event to be called before the TextChanged event is called. My honest opinion is that it is pretty stupid to call the TextChanged event before the SelectedIndexChanged event because it prevents me from knowing if the TextChanged event was called because a new item was selected.
Any help would be much appreciated.
No, you can’t change the order – it’s hard coded into the control code:
If you have handlers for each event and need them to run in a certain order you could have the
TextChangedevent look for some indicator that theSelectedIndexChangedevent has happened, then call theTextChangedhandler from theSelectedIndexChangedhandler, or just haveSelectedIndexChangeddo all the work.It depends on why you need them to run in a certain order.