There are a number of ways to get around this.
One way that I have done this in the past is to have a
variable on the form that I call something like
Before you start to fill the
with values, you set
. (or a more object-oriented way might be to have a function called
that you call ie.
that sets the boolean value to
and then call another function called
.) Then, after you've finished filling it and setting the SelectedIndex to -1, set
Then, in your
event, the very first thing you have is an if statement...
That will prevent anything else from running. IMO, there's nothing wrong with doing this.
You can also do as Vipin said. I generally do a combination of the two.