Hi All,

Does anyone know how I can validate data entered into the cell of a datagrid?

What I am trying to do is this: each time a user enters a value into a particular columns cell, I want to update the corresponding cell depending on the value entered.

For example:

if the user enters a value < 10 into Column A then I want to auto update Column B to have the value "RED" and if the user input is >=10, I want to update it to read "BLUE". The problem is; I can't find an event that fires after the user leaves the cell.

|ColA | ColB
1|------|-------
2| 9 | RED
3| 20 | BLUE


Can anyone please help.

Thanks!!

What you think about "CellEndEdit" event?

In addition to what the charmant Antenka said
you can derive an object form the datagridview and ovveride the protected method OnCellValueChanged

to change the cell backcolor you can use the celltemplate property of the datagridcolumn object

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.