I had a problem where images assigned to items in a ListView, via ImageIndex (using an ImageList) were disappearing. This occurred on second or third and subsequent runs of my application, where a ‘first run’ was defined as one where a recompile had been performed after an (unrelated) code change.
Don’t you just love it when your software does something different the second and subsequent times you run it, even though you didn’t change anything and there are no changes to the input - all you did was restart it?
The problem turns out to be related to XP visual styles. If you call EnableVisualStyles after you have already run some Windows.Forms code (I was showing a splash screen) then the bug appears.
The workaround is to move your EnableVisualStyles (and the DoEvents which needs to come after it) to the very beginning of your Main() sub.
Thanks to Herfried K. Wagner on microsoft.public.dotnet.framework.windowsforms for helping to track this one down.