Changeset 275 for trunk/sources
- Timestamp:
- 05/29/08 18:23:47 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataAnalysis/DatasetView.cs
r274 r275 54 54 base.UpdateControls(); 55 55 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; 56 62 int rows = Dataset.Rows; 57 63 int columns = Dataset.Columns; … … 67 73 } 68 74 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 70 76 dataGridView.Columns[i].Name = GetColumnName(i); 71 77 } 72 //dataGridView.SelectionMode = DataGridViewSelectionMode.ColumnHeaderSelect;78 dataGridView.SelectionMode = DataGridViewSelectionMode.ColumnHeaderSelect; // switch back to column selection 73 79 } else { 74 80 rowsTextBox.Text = "1";
Note: See TracChangeset
for help on using the changeset viewer.