hello all

I fill datagridview Row[0].Cells[0] with the following command

dgv1.Rows[0].Cells[(0].Value="-1";

//-------------------
how to give color so that the content "-1" in datagridview has red in color (forecolor)

thank you

denny

You can use the CellFormatting event to do this.
The following code snippet colours cells in the third column if they have a value of "-1".

private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            var cell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
            if (e.ColumnIndex == 2 && ((string)cell.Value) == "-1")
            {
                e.CellStyle.ForeColor =  Color.Red;
            }
        }

You must check the column index to ensure the test is applied to the right data value.