Skip to main content

Posts

Showing posts with the label coloring in particular cells using data grid

Coloring in particular cells using data grid

Coloring in particular cells using data grid foreach (DataGridViewRow dataGridViewRow in dataGridView1.Rows) { DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle(); dataGridViewCellStyle.ForeColor = Color.Red; if (dataGridViewRow.Cells[2].Value != null) { if (dataGridViewRow.Cells[2].Value.ToString().Trim().Equals("M", StringComparison.CurrentCultureIgnoreCase)) { dataGridViewRow.DefaultCellStyle = dataGridViewCellStyle; } } }