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.


Dorababu MekaRank #457 · 5.5K reputationPosted Jul 27, 2016, 1:19 AM EDT
Mohammed AshrafRank #900 · 2.3K reputationPosted Jul 27, 2016, 1:58 AM EDT
Tapan PatelRank #614 · 3.9K reputationPosted Jul 27, 2016, 8:10 AM EDT
Mohammed AshrafRank #900 · 2.3K reputationPosted Jul 27, 2016, 9:05 PM EDT
Dorababu MekaRank #457 · 5.5K reputationPosted Jul 27, 2016, 10:46 PM EDT
Mohammed AshrafRank #900 · 2.3K reputationPosted Jul 28, 2016, 12:33 AM EDT
ali tuncerRank #1,499 · 1.1K reputationPosted Jul 28, 2016, 9:32 PM EDT
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);
}
Dorababu MekaRank #457 · 5.5K reputationPosted Jul 28, 2016, 10:01 PM EDT
Mohammed AshrafRank #900 · 2.3K reputationPosted Jul 29, 2016, 4:52 AM EDT