Пример #1
0
        /// <summary>
        /// Prepares and fills the preview grid with data.
        /// </summary>
        private void FillPreviewGrid()
        {
            _importColumns = null;
            SetImportParameterValues(Settings.Default.ImportPreviewRowsQuantity);
            _previewDataTable              = _dbTableOrView.GetData();
            _totalRowsCount                = _dbTableOrView.GetRowsCount();
            RowsCountSubLabel.Text         = _totalRowsCount.ToString(CultureInfo.InvariantCulture);
            PreviewDataGridView.DataSource = _previewDataTable;
            foreach (DataGridViewColumn gridCol in PreviewDataGridView.Columns)
            {
                gridCol.SortMode = DataGridViewColumnSortMode.NotSortable;
            }

            PreviewDataGridView.SelectionMode = DataGridViewSelectionMode.FullColumnSelect;
            FromRowNumericUpDown.Maximum      = _totalRowsCount;
            _importIsCappedByRows             = ExcelUtilities.CheckIfRowsExceedWorksheetLimit(_totalRowsCount);
            SetCompatibilityWarningControlsVisibility(_importIsCappedByRows);
            RowsToReturnNumericUpDown.Maximum = Math.Min(FromRowNumericUpDown.Maximum, _activeWorkbookMaxRowNumber - _atRow - FromRowNumericUpDown.Value + 1);
        }