- Timestamp:
- 04/01/19 09:59:16 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/NamedIntervalsView.cs
r16634 r16730 130 130 // we can assume it's the users fault if he or she enters incorrect values 131 131 132 //if (dataGridView.Rows[e.RowIndex].IsNewRow) {133 //return;134 //}135 //136 //if (!double.TryParse(e.FormattedValue.ToString(), out var value)) {137 //e.Cancel = true;138 //dataGridView.Rows[e.RowIndex].ErrorText = "Value must be a double value.";139 //} else if (string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString()) ||140 //string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString())) {141 //// accept any value if one of the cells is still empty142 //} else {143 //var left = double.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString());144 //var right = double.Parse(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString());145 //if (e.ColumnIndex == 1 && value < left || e.ColumnIndex == 0 && value > right) {146 //e.Cancel = true;147 //dataGridView.Rows[e.RowIndex].ErrorText = "Lower bound of interval must be smaller than upper bound.";148 //}149 //}132 if (dataGridView.Rows[e.RowIndex].IsNewRow) { 133 return; 134 } 135 136 if (!double.TryParse(e.FormattedValue.ToString(), out var value)) { 137 e.Cancel = true; 138 dataGridView.Rows[e.RowIndex].ErrorText = "Value must be a double value."; 139 } else if (string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString()) || 140 string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString())) { 141 // accept any value if one of the cells is still empty 142 } else { 143 var left = double.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString()); 144 var right = double.Parse(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString()); 145 if (e.ColumnIndex == 1 && value < left || e.ColumnIndex == 0 && value > right) { 146 e.Cancel = true; 147 dataGridView.Rows[e.RowIndex].ErrorText = "Lower bound of interval must be smaller than upper bound."; 148 } 149 } 150 150 } 151 151
Note: See TracChangeset
for help on using the changeset viewer.