Need listbox event to determine when an item has been added or removed
Posted on 2004-10-11
Not sure why I can't find this in the docs or online - maybe I'm just looking in the wrong places. Anyway, here's the deal -
I'm building a wizard-type application. On one page, a listbox is presented with small buttons to add and delete directories from the listbox. Directories might also be added to this box from other portions of the wizard.
When the user first enters this page, I make a check to see if entries exist in the listbox, and if not, the NEXT button is disabled. The user can now add/delete directories - whenever anything is added or delete, I need to check and see if I should enable the NEXT button to allow them to continue.
Now I suppose I could code these checks into the add, delete and other buttons, but that's seems redundent, hard to trace, and error prone. What I want to do is have an event fire every time an item is added or removed from the listbox.
The SelectedItemChanged event does not work, because in most cases (in this app anyway) nothing is selected to begin with, so adding or removing an item doesn't cause the event to fire until you select something - not what I want.
Is there an event that fires when I do this?