Changeset 9307


Ignore:
Timestamp:
03/12/13 09:26:49 (7 years ago)
Author:
sforsten
Message:

#2018: restored original behaviour of StringConvertibleMatrixView

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r9306 r9307  
    130130      virtualRowIndices = Enumerable.Range(0, Content.Rows).ToArray();
    131131
    132       //dataGridView.RowCount = 0;
    133 
    134132      if (Content.Columns == 0) {
    135133        Content.Columns = 1;
     
    262260    #region DataGridView Events
    263261    private void dataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) {
    264       if (!dataGridView.ReadOnly) {
     262      // RowIndex and ColumnIndex have to be checked, if they are in bounds, otherwise Cancel might be set, which can lead to exceptions
     263      if (!dataGridView.ReadOnly && e.RowIndex < Content.Rows && e.ColumnIndex < Content.Columns) {
    265264        string errorMessage;
    266265        if (Content != null && !Content.Validate(e.FormattedValue.ToString(), out errorMessage)) {
    267           //e.Cancel = true;
     266          e.Cancel = true;
    268267          dataGridView.Rows[e.RowIndex].ErrorText = errorMessage;
    269268        }
Note: See TracChangeset for help on using the changeset viewer.