Overwriting the value of a datagridview cell on validating, seems impossible, all the ways you can get to the value of the cell tell you they are Read-Only, the key is the EditingControl Property:
private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) {
DataGridViewCell cell =
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
if (cell.IsInEditMode)
{
Control c = dataGridView1.EditingControl;
c.Text = CleanInputNumber(c.Text);
}
}
No comments:
Post a Comment