private void dataGridViewBufferData_RowEnter(object sender, DataGridViewCellEventArgs e) { buttonAccept.Enabled = (dataGridViewBufferData.Rows[e.RowIndex].DefaultCellStyle.BackColor != Color.DarkSalmon); string dataName = dataGridViewBufferData.Rows[e.RowIndex].Cells[0].Value.ToString(); textBoxSaveName.Text = dataName; selName = dataName; //Loading user control BufferData bd = DataBuffer.Instance.Load(dataName); editedBd = bd; UserControl uc = bd.GenerateControl(); foreach (Control c in panelUC.Controls) { c.Dispose(); } panelUC.Controls.Clear(); panelUC.Controls.Add(uc); bd.ChangeOccured -= UpdateBufferData; bd.ChangeOccured += UpdateBufferData; }