Free cookie consent management tool by TermsFeed Policy Generator

Changeset 275 for trunk/sources


Ignore:
Timestamp:
05/29/08 18:23:47 (16 years ago)
Author:
gkronber
Message:

fixed #157

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataAnalysis/DatasetView.cs

    r274 r275  
    5454      base.UpdateControls();
    5555      if (Dataset != null) {
     56        // DataGridView is bitching around. The columnCount (maybe also rowCount) is changed it creates
     57        // new column objects and they have SortMode set to 'automatic'. However this is not allowed if the
     58        // selectionmode is set to 'ColumnHeaderSelect' at the same time resulting in an exception.
     59        // A solution is to set the SelectionMode to CellSelect before any changes. And after the columns
     60        // have been updated (and their SortMode set to 'NotSortable') we switch back to SelectionMode=ColumnHeaderSelect.
     61        dataGridView.SelectionMode = DataGridViewSelectionMode.CellSelect;
    5662        int rows = Dataset.Rows;
    5763        int columns = Dataset.Columns;
     
    6773        }
    6874        for (int i = 0; i < columns; i++) {
    69           dataGridView.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
     75          dataGridView.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; // SortMode has to be NotSortable to allow ColumnHeaderSelect
    7076          dataGridView.Columns[i].Name = GetColumnName(i);
    7177        }
    72         //dataGridView.SelectionMode = DataGridViewSelectionMode.ColumnHeaderSelect;
     78        dataGridView.SelectionMode = DataGridViewSelectionMode.ColumnHeaderSelect; // switch back to column selection
    7379      } else {
    7480        rowsTextBox.Text = "1";
Note: See TracChangeset for help on using the changeset viewer.