I have been working on a quick WinForms program. I found this SO question about getting a ListBox to refresh and I thought Brad Bruce's answer was interesting, though I know binding is the correct way of solving the problem. So I went to try his solution of inheriting ListBox
and declared a similar class(names were modified to be read easier):
public class AustinListBox : ListBox
{
public void AustinRefreshItems()
{
RefreshItems();
}
}
Note, my code compiled and worked perfectly before I typed this code. After declaring this and without referencing this new class, I went to run the program... and BAM I was given a run time error saying that 2 toolStripButtons (which are placeholders by the way, I have changed nothing about them and they are not used anywhere) could not load their image. And yet the default images are located in Form1.resx just like they were before. It also would not let me view the design of Form1.
What does an unused class declaration have to do with two default toolStripbutton's images at run time? If I comment out the 7 lines of AustinListBox
code, everything magically works again.