DataGridViewCellStyle style = new DataGridViewCellStyle();
foreach ( DataGridViewRow aRow in dataGridView3.Rows)
{
if (aRow.Cells["message"].Value.ToString() == "不存数据")(未将对象引用设置到对象的实例)
{
aRow.DefaultCellStyle.ForeColor = Color.Red; }
}
上面提示,使用NEW关键字创建实例,该怎么样修改,谢谢
foreach ( DataGridViewRow aRow in dataGridView3.Rows)
{
if (aRow.Cells["message"].Value.ToString() == "不存数据")(未将对象引用设置到对象的实例)
{
aRow.DefaultCellStyle.ForeColor = Color.Red; }
}
上面提示,使用NEW关键字创建实例,该怎么样修改,谢谢
有没有这么一列。
if (aRow.Cells["message"].Value != null)
if (aRow.Cells["message"].Value.ToString() == "不存数据")
aRow.DefaultCellStyle.ForeColor = Color.Red;