listbox events

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey all,

I noticed that the listbox event "SelectedIndex_Changed" runs on form load
by default. Is there a way to by pass this until you actually have data in it
and are ready for selected index change event in your code or am I missing
the point?

thanks in advance,
rodchar
 
Are you sure? Just to make sure, I tested it out and it does not fire the
SelectedIndex_Changed event on the listbox. Are you setting the
SelectedIndex or SelectedItem property (or calling the Select method) in the
form load? Only then the event would be fired.


Imran.
 
if your listbox is databound, the index will change on filling a dataset...
the best thing to do in that case is to set a flag when its filling so you
can check that flag in the selected index changed event to see if the index
is changing while its filling or not to prevent execution of the event while
that is happening
 
Thank you, this helped.

Brian Henry said:
if your listbox is databound, the index will change on filling a dataset...
the best thing to do in that case is to set a flag when its filling so you
can check that flag in the selected index changed event to see if the index
is changing while its filling or not to prevent execution of the event while
that is happening
 
Back
Top