Я немного поигрался с сетевыми представлениями, и возник вопрос.
-> Не меняет фон ячейки, работает из события CellFormatting.
Я пробовал это:
private void dataGridView1_CellFormatting(object sender, dataGridViewCellFormattingEventArgs e)
{
if (dataGridView1.Columns[e.ColumnIndex].Name.Equals(dnsList.First<String>()))
{
DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
DataGridViewCell cell = row.Cells[e.ColumnIndex];
cell.Style.BackColor = Color.FromArgb(194, 235, 211);
}
}
, который работает отлично, тогда как это:
private void ApplyColoring()
{
if (dataGridView1.DataSource != null)
{
foreach (DataGridViewRow dataGridRow in dataGridView1.Rows)
{
DataGridViewCell cell = dataGridRow.Cells[dnsList.First<String>()];
cell.Style.BackColor = Color.FromArgb(194, 235, 211);
}
}
}
Отладка говорит мне, что все звучит нормально, с нулевой ссылкой или любым другим исключением
Любые советы?