private void SetSource(DBEntry dt, bool resetcolumns = true) { advancedDataGridView.RowHeadersVisible = false; advancedDataGridView.ColumnHeadersVisible = false; advancedDataGridView.SuspendLayout(); //Performance if (dt != null) { this.Tag = dt.Tag; this.Text = $"WDBX Editor - {dt.FileName} {dt.BuildName}"; LoadedEntry = dt; //Set current table if (_bindingsource.IsSorted) { _bindingsource.RemoveSort(); //Remove Sort } if (!string.IsNullOrWhiteSpace(_bindingsource.Filter)) { _bindingsource.RemoveFilter(); //Remove Filter } _bindingsource.DataSource = dt.Data; //Change dataset _bindingsource.ResetBindings(true); columnFilter.Reset(dt.Data.Columns, resetcolumns); //Reset column filter wotLKItemFixToolStripMenuItem.Enabled = LoadedEntry.IsFileOf("Item", Expansion.WotLK); //Control WotLK Item Fix advancedDataGridView.Columns[LoadedEntry.Key].ReadOnly = true; //Set primary key as readonly advancedDataGridView.ClearSelection(); advancedDataGridView.CurrentCell = advancedDataGridView.Rows[0].Cells[0]; } else { this.Text = "WDBX Editor"; this.Tag = string.Empty; LoadedEntry = null; txtStats.Text = txtCurEntry.Text = txtCurDefinition.Text = ""; columnFilter.Reset(null, true); FormHandler.Close(); } advancedDataGridView.ClearCopyData(); advancedDataGridView.ClearChanges(); pasteToolStripMenuItem.Enabled = false; undoToolStripMenuItem.Enabled = false; redoToolStripMenuItem.Enabled = false; }