We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Handling Invalid Format settings

Hi, In my virtual grid I allow the user to set their own Format settings. However, if the format settings is invalid (eg "d" date time formatting for a double value 1.403) the cell goes red with the text "Exception". What would be the best way of handling such invalid format settings such that in the example above it displays the minimum date (or some other random date) rather than erroring? Thanks, Sue

1 Reply

AD Administrator Syncfusion Team July 4, 2005 09:12 AM UTC

The red X suggests that the problem is occurs while the grid is trying to paint the cell. Catching the error at this point is a little problematic as you would have to guess at what caused the particular exception (whether it is a format problem, or a invalid data problem, and something entirely off the wall). If you want to do this, you can try subscribing to the event Syncfusion.Windows.Forms.ExceptionManager.ExceptionCatched to get any exception thrown, and handle them yourself. But it will probably be simpler to somehow check the format at the point your user enters it to see if it is valid for the indicated range. At that point, a try catch block could be used to test the format against (some of or even all of) the indicated grid values to see if things arre OK before you leave the UI context of entering a format.

Loader.
Live Chat Icon For mobile
Up arrow icon