How to prevent bad formatted data input in DataGridViewCell
Posted
by JuanNunez
on Stack Overflow
See other posts from Stack Overflow
or by JuanNunez
Published on 2010-06-16T09:17:02Z
Indexed on
2010/06/16
9:22 UTC
Read the original article
Hit count: 174
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?
© Stack Overflow or respective owner