Groups | Blog | Home
all groups > c# > april 2008 >

c# : DataGridView : How to Transform data between user input and validation ?



Dom
4/23/2008 11:24:53 AM
[quoted text, click to view]

Try the CellValidating event. Also, the EventArgs in this event has a
"Cancel" member, which prevents the user from leaving the cell, if it
Ignacio Machin ( .NET/ C# MVP )
4/23/2008 12:27:06 PM
[quoted text, click to view]

Hi,

There are a couple of events you could try:
CellEndEdit
CellLeave
CellValidating

Ignacio Machin ( .NET/ C# MVP )
4/23/2008 12:30:32 PM
[quoted text, click to view]

Hi,

Note that for consistence you should also have the other way around
conversion, when the user start editing a cell the cell should
TheSteph
4/23/2008 8:04:24 PM
Hi !

I have a DataGridView with a Date (DateTime) Column.

When a user edit the cell and change the date I woulk like to allow him to
write "081501" and programmatically transform the entered date to
"2008/15/01"( using a custom method called TransformDate(string ARawDate))

But I can't find any DataGridView event to call the TransformDate method and
replace the user input by the computed value. I always get a "DataError".

Does anybody if this kind of transformation is possible in a DataGridView
and Where is the best place to put the call to the transformation method ?

Thanks for your help !

Steph.



AddThis Social Bookmark Button