Here I am explaining Register or Unregister controls
event in C# Windows. Suppose you have a Form in Windows
Application. It contain a ComboBox and a label (to show result) like below
img.
Now In code behind of above form Write below
code. .
With the above code, run this application.
Now debug the code. you will see that you debugger goes to the
combobox_selectindexchanged after the form_load.
Bcoz when you write this line
"comboBox1.SelectedIndex=0". here you change your combobox index
programmatically
That's why it call selectindexchange. To
prevent this problem You have to unregistered your control event according
to your requirement. Now,
On the Form_load you have to unregistered
your combobox_selectindexchanged and after the binding of combobox you
have to register your event
combobox_selectindexchanged like below img.
If there is any suggestion please leave
comment.