Watching a listbox
-
I have a listbox control that contains one or more directories. How do I watch this listbox to see if something is added or removed to it so I can proceed to update my other controls depending on what changed. I can't see an event that really pertains to this, maybe DrawItem but that seems like a bit of an ugly solution. Thanks, sorry if this doesn't make sense, sleep is needed.
-
I have a listbox control that contains one or more directories. How do I watch this listbox to see if something is added or removed to it so I can proceed to update my other controls depending on what changed. I can't see an event that really pertains to this, maybe DrawItem but that seems like a bit of an ugly solution. Thanks, sorry if this doesn't make sense, sleep is needed.
Can't you update the other controls from the code that updates the listbox?
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus) -
I have a listbox control that contains one or more directories. How do I watch this listbox to see if something is added or removed to it so I can proceed to update my other controls depending on what changed. I can't see an event that really pertains to this, maybe DrawItem but that seems like a bit of an ugly solution. Thanks, sorry if this doesn't make sense, sleep is needed.
If listbox is in your application then your code is adding items so you should know when an item is added.
Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion
-
I have a listbox control that contains one or more directories. How do I watch this listbox to see if something is added or removed to it so I can proceed to update my other controls depending on what changed. I can't see an event that really pertains to this, maybe DrawItem but that seems like a bit of an ugly solution. Thanks, sorry if this doesn't make sense, sleep is needed.
You probably want the filesystemwatcher, look into the IO namespace for it. Caveat, the early version choked on too many events but I have not used it since v1
Never underestimate the power of human stupidity RAH