R
Ravi Kumar12233
Guest
Dear all ,
In my data-grid view for one column called "Next calibration" i am using below code to highlight the cell if the date is over( compared to today) .
private void dataGridViewforentryform_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
try
{
var cellvalue = dataGridViewforentryform.Rows[e.RowIndex].Cells["nextCalibrationOnDataGridViewTextBoxColumn"].Value;
if (Convert.ToDateTime(cellvalue) < DateTime.Now)
dataGridViewforentryform.Rows[e.RowIndex].Cells["nextCalibrationOnDataGridViewTextBoxColumn"].Style.ForeColor = Color.Red;
dataGridViewforentryform.Rows[e.RowIndex].Cells["nextCalibrationOnDataGridViewTextBoxColumn"].Style.SelectionForeColor = Color.Red;
}
catch (Exception)
{
// throw;
}
}
How ever if i select any other row in my data-grid view & try to close the form this below error is coming , please guide me how to solve this.
Continue reading...
In my data-grid view for one column called "Next calibration" i am using below code to highlight the cell if the date is over( compared to today) .
private void dataGridViewforentryform_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
try
{
var cellvalue = dataGridViewforentryform.Rows[e.RowIndex].Cells["nextCalibrationOnDataGridViewTextBoxColumn"].Value;
if (Convert.ToDateTime(cellvalue) < DateTime.Now)
dataGridViewforentryform.Rows[e.RowIndex].Cells["nextCalibrationOnDataGridViewTextBoxColumn"].Style.ForeColor = Color.Red;
dataGridViewforentryform.Rows[e.RowIndex].Cells["nextCalibrationOnDataGridViewTextBoxColumn"].Style.SelectionForeColor = Color.Red;
}
catch (Exception)
{
// throw;
}
}
How ever if i select any other row in my data-grid view & try to close the form this below error is coming , please guide me how to solve this.
Continue reading...