日期:2014-05-18 浏览次数:20814 次
private void dataGridView1_CellParsing(object sender, DataGridViewCellParsingEventArgs e) { if (e.ColumnIndex == 1) { if (float.Parse(e.Value.ToString()) > 200) { dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.ForeColor = Color.Red; MessageBox.Show("请注意,您输入的值超超过标准值!200 ", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void dataGridView1_CellParsing(object sender, DataGridViewCellParsingEventArgs e) { if (e.ColumnIndex == 1) { if (float.Parse(e.Value.ToString()) > 200) { dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.ForeColor = Color.Red; dataGridView1.EditingControl.ForeColor = Color.Red; MessageBox.Show("请注意,您输入的值超超过标准值!200 ", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }