private void fillGrid() { db = new DB(this); try { newFieldsTable = db.getNewFields(wizard.FileName); newFieldsTable.Columns["Field"].ReadOnly = true; dataGridView1.DataSource = newFieldsTable; } catch (Exception ex) { MessageBox.Show(ex.Message); Close(); } }
private void fillGrid() { db = new DB(); try { ignoredFields = db.getNewFields(wizard.FileName); foreach (DataColumn column in ignoredFields.Columns) { column.ReadOnly = true; } ignoredFields.Columns[DB.IMPORT].ReadOnly = false; ignoredFields.Columns[DB.IGNORE].ReadOnly = false; dataGridView1.DataSource = ignoredFields; dataGridView1.ReadOnly = true; ///ignoredFields.RowChanged += new DataRowChangeEventHandler(rowChanged); btnIgnoreSelectedFields.Enabled = (dataGridView1.RowCount > 0); chkImport.Checked = true; foreach (DataGridViewColumn gridColumn in dataGridView1.Columns) gridColumn.SortMode = DataGridViewColumnSortMode.NotSortable; DataRow[] rows = ignoredFields.Select("Field LIKE 'Column%'"); if ((rows != null) && (rows.Length > 0)) { dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.Rows.Count - 1; dataGridView1.Rows[dataGridView1.Rows.Count - 1].Selected = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); Close(); } }