Data Browser - Viewing Site  Sector 23 Code Bank Logged in as:  Guest  


The Big Red X- Nemesis of the Datagrid
Once you begin overriding the Paint methods for a datagrid, chances are you've run across the Big Red X. And you've discovered that the only way to make it go away is to close the form/application and start over.
It comes from a simple source... if an exception is thrown while the grid is being drawn, the grid is flagged as "bad", and the Big Red X comes to remind you that something went wrong. Like you need to be told when your Paint methods aren't drawing correctly. And, it doesn't go away until the control is completely destroyed. (Alternatively, there is some interesting reflection code to get at the flag...)
So anyway, the best way to solve this is to just track down where the exception is being thrown. This is because the Paint/Draw Cell/etc methods automatically catch the exception (don't ask me why) so that you don't know where it happened. Put try/catch blocks around every piece of code you wrote, and pop up a message if an error is found. Good luck defeating the Big Red X!

Created By: amos 3/20/2006 12:13:01 AM