For a Windows Forms Application using `DataGridView`, how can I check a value in my DataSource and change the color of a separate cell?
问题 Very specific question, I know. I'm not sure how best to word this. Currently, my cell_formatting method will change the color of a cell based on its value: dataGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.cell_formatting); .... public void cell_formatting(object sender, System.Windows.Forms.DataGridViewCellFormattingEventArgs e) { if (dataGridView.Columns[e.ColumnIndex].Name.Equals("LocCode")) { if (e.Value.ToString() == "OK") { e.CellStyle