Just a quick post to help out anyone who hits the same bug I have.
It appears that there are a couple of issues with WinForms ListBoxes when the SelectionMode is None (certainly in .net 2).
One that is pretty well documented is that if your SelectionMode is None then you can get problems on closing the form (https://connect.microsoft.com/VisualStudio/feedback/details/189700/listbox-selectionmode-none-bug)
One I've just hit on is that if you rebind/refresh a listbox's contents by changing the datasource then the list is cleared and left blank
The workaround is very simple (based on the one from Connect) - before manipulating the DataSource property on the ListBox change the SelectionMode to one of the other values, do your work, then change it back to None
Hope this helps
ListView selection mode customizing
ReplyDelete