M
moondaddy
I am experimenting with different ways to handle the selecting items from a
combo's dropdown list. Typically I use the selected index changed event to
do something with the new item selected in the list. However, I also use
some custom methods to simulate an autocomplete combo when the user types
text into the combo and also when the focus leaves the combo. So here's
what I'm wondering:
Often the datasource of the combo is a dataset and when I do something like
edit the dataset or re-populate it the SelectedIndexChanged event fires
which takes up resources and sometimes causes bugs in my code. So I try to
put a flag at the beginning of the event procedure where if the flag = True,
then exit the procedure. If I get rid of this SelectedIndexChanged event
procedure all together, will this be much cleaner and a more efficient
execution of code? If so, then the code I would have executed in the
SelectedIndexChanged event procedure can be called from my custom methods
used for the autocomplete effect. By doing this I think I'll have more
control over precisely executing code when an item has been properly
selected in the dropdown list and avoid unnecessary execution of the
SelectedIndexChanged event.
Comments and opinions?
combo's dropdown list. Typically I use the selected index changed event to
do something with the new item selected in the list. However, I also use
some custom methods to simulate an autocomplete combo when the user types
text into the combo and also when the focus leaves the combo. So here's
what I'm wondering:
Often the datasource of the combo is a dataset and when I do something like
edit the dataset or re-populate it the SelectedIndexChanged event fires
which takes up resources and sometimes causes bugs in my code. So I try to
put a flag at the beginning of the event procedure where if the flag = True,
then exit the procedure. If I get rid of this SelectedIndexChanged event
procedure all together, will this be much cleaner and a more efficient
execution of code? If so, then the code I would have executed in the
SelectedIndexChanged event procedure can be called from my custom methods
used for the autocomplete effect. By doing this I think I'll have more
control over precisely executing code when an item has been properly
selected in the dropdown list and avoid unnecessary execution of the
SelectedIndexChanged event.
Comments and opinions?