I\'m trying to build a simple music player with a ListBox playlist. When adding audio files to the playlist, it first fills the ListBox with the filenames and then (on a sep
It might be prudent to disable any painting of the Listbox when doing the updates. Use ListBox.BeginUpdate()
and then update the entries, when done, invoke ListBox.EndUpdate()
. This should ensure that no refreshes occurs during the update.
You should also ensure that you do not refresh the ListBox from a thread either as cross-threading is dis-allowed, and the runtime will barf with a message saying that 'Cross Threading Exception' has occurred.
Use the ListBox's BeginInvoke(...)
method to get around the cross threading issue. See here on the MSDN on how this is done.