How to prevent bad formatted data input in DataGridViewCell
- by JuanNunez
I have an automatically binded DataGridView that obtains data and update data directly from a Strongly Typed Dataset and its TableAdapter.
the DataGridView allows data editing but I'm having issues dealing with bad formatted data input.
For example, one of the columns is a date, formatted in the database as datetime, 11/05/2010. You can edit the date and the DataGridView opens a TextBox in wich you can enter letters, simbols and other unauthorised characters. When you finish editing the cell if has such bad data it throws a System.FormatException
How can I prevent some data to be entered?
Is there a way to "filter" that data before it is sent back to the DataGridView?