Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16888


Ignore:
Timestamp:
05/02/19 13:10:57 (6 years ago)
Author:
chaider
Message:

#2971 fixed NamedIntervalsView

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/NamedIntervalsView.cs

    r16887 r16888  
    125125
    126126    private void dataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) {
    127       // DISABLED VALIDATION OF ENTRIES
    128       // because it leads to problems when updating the table
    129       // we can assume it's the users fault if he or she enters incorrect values
    130 
    131       if (dataGridView.Rows[e.RowIndex].IsNewRow) {
    132         return;
    133       }
    134      
    135127      if (!double.TryParse(e.FormattedValue.ToString(), out var value)) {
    136128        e.Cancel = true;
    137129        dataGridView.Rows[e.RowIndex].ErrorText = "Value must be a double value.";
    138       } else if (string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString()) ||
     130        return;
     131      }/* else if (string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString()) ||
    139132        string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString())) {
    140133        // accept any value if one of the cells is still empty
    141       } else {
    142         var left = double.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString());
    143         var right = double.Parse(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString());
    144         if (e.ColumnIndex == 1 && value < left || e.ColumnIndex == 0 && value > right) {
     134      } */else {
     135        var lowerBound = double.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString());
     136        var upperBound = double.Parse(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString());
     137        if (e.ColumnIndex == 1 && value < lowerBound || e.ColumnIndex == 0 && value > upperBound) {
    145138          e.Cancel = true;
    146139          dataGridView.Rows[e.RowIndex].ErrorText = "Lower bound of interval must be smaller than upper bound.";
Note: See TracChangeset for help on using the changeset viewer.