private void dgtaskdetails_CellLeave_2(object sender, DataGridViewCellEventArgs e) { if (dgtaskdetails.Columns[e.ColumnIndex].Name == "End-Date") { var returnDate = Convert.ToDateTime(dataGridView1.Rows[e.RowIndex].Cells["End-Date"].Value); var borrowDate = Convert.ToDateTime(dataGridView1.Rows[e.RowIndex].Cells["Start-Date"].Value); if (returnDate > borrowDate) { MessageBox.Show(""From Date" cannot be greater than "To Date""); } }
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)