to DataGridViewCellFormattingEventArgs.Value, which is passed by to a
method that is hooked to CellFormatting event.
The way to avoid it, is to access to the cell value directly.
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if(e.ColumnIndex==5) { // If set, the following will be shown in the cell. The Cell's value typed as an int will not be set correctly. //e.Value = "1"; // Instead, directly access the Cell object. int row = e.RowIndex; int col = e.ColumnIndex; dataGridView1.Rows[row].Cells[col].Value = 1; break; } }