Dear All,
I want change cell color and style while entering data into it.
I used following code but not work. Please help me.
dataGridView1.Rows.Add(strAccountName).DefaultCellStyle.BackColor =Color.Yellow;
Please note that I want to change forecolor and boldness.

Mohammed AshrafPosted Jul 29, 2016, 8:52 AM
Dorababu MekaPosted Jul 29, 2016, 2:01 AM
ali tuncerPosted Jul 29, 2016, 1:32 AM
if you want to change after you add row,try this way :
dataGridView1.Rows.Add("Inv Date - " + strDate);
dataGridView1.Rows[dataGridView1.Rows.Count-2].DefaultCellStyle.ForeColor = Color.Blue;
dataGridView1.Rows[dataGridView1.Rows.Count-2].DefaultCellStyle.Font = new Font(DataGridView.DefaultFont, FontStyle.Bold)
{
row.DefaultCellStyle.ForeColor = Color.Blue;
row.DefaultCellStyle.Font = new Font(DataGridView.DefaultFont, FontStyle.Bold);
}
Mohammed AshrafPosted Jul 28, 2016, 4:33 AM
Dorababu MekaPosted Jul 28, 2016, 2:46 AM
Mohammed AshrafPosted Jul 28, 2016, 1:05 AM
Tapan PatelPosted Jul 27, 2016, 12:10 PM
Mohammed AshrafPosted Jul 27, 2016, 5:58 AM
Dorababu MekaPosted Jul 27, 2016, 5:19 AM