public RevisionForm(List <RevisionCl> revL) { InitializeComponent(); try { if (Svera.Properties.Settings.Default.RevisionSize != new Size(0, 0)) { this.Size = Svera.Properties.Settings.Default.RevisionSize; } List <ColumnNames> ColList = Revision.GetColumns(); if (ColList.Count > 0) { DataGridViewColumn[] dataGridColSver = new DataGridViewColumn[ColList.Count]; ColumnNames colName; for (int i = 0; i <= ColList.Count - 1; i++) { colName = ColList[i]; dataGridColSver[i] = new DataGridViewTextBoxColumn(); dataGridColSver[i].Name = colName.nameColumn; dataGridColSver[i].HeaderText = colName.textColumn; dataGridColSver[i].DataPropertyName = colName.nameColumn; dataGridColSver[i].SortMode = DataGridViewColumnSortMode.NotSortable; dataGridColSver[i].ReadOnly = colName.readOnly; } sverPDataGrid.Columns.AddRange(dataGridColSver); sverPDataGrid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; // sverPDataGrid.Columns[SveraParam.ColDatagridNames.Value].DefaultCellStyle.WrapMode = DataGridViewTriState.True; } rev = new Revision(revL); sverPDataGrid.AutoGenerateColumns = false; // sverPDataGrid.DataSource = typeof(List<RevisionCl>); sverPDataGrid.DataSource = rev.RevLDataSource; SizeChange(); load = true; } catch (Exception ex) { MessageBox.Show(ex.Message); MessageBox.Show(ex.StackTrace); if (ex.InnerException != null) { MessageBox.Show(ex.InnerException.ToString()); } } }