如何更改放置在gridview值内的文本框,如果该值不是数字,我希望文本框在该列位置放置0
private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
if (e.ColumnIndex == 1) // column to check for only numeric values
{
int i;
if (!int.TryParse(Convert.ToString(e.FormattedValue), out i))
{
e.Cancel = true; // halting the tool till correct value in the cell but I want that instead of this line I want to place a value in that cell
}
else
{
// the input is numeric
}
}
}