I'm curious about something.
If I have a listbox that is databound and a filter is applied to that listbox based on the value in a combobox, what would be the best way to handle the null reference exception thrown when the form loads or the filter changes and everything is filtered out. Right now I just have a "IsLoading" and "IsClosing" bool value that I change in those two events and just have a simple if statement to basically ignore the exception if either of those values is true.
But I'm not sure if this is the best way to handle this. I keep thinking that if a method is throwing an exception and you just "filter" the exceptions like I am doing and ignore some, it could be a problem later.
Any suggestions/thoughts?