private void btnAddUser_Click(object sender, EventArgs e) { frmAddUser frm = new frmAddUser() { AutoScroll = false, TopLevel = false, WindowState = FormWindowState.Maximized }; this.Parent.Controls.Add(frm); frm.Show(); this.Parent.Controls.Remove(this); }
private void dgv_Users_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { try { var value = dgv_Users.SelectedRows[0].Cells[0].Value; int index = int.Parse(value.ToString()); if (index > 0) { frmAddUser frm = new frmAddUser(index) { AutoScroll = false, TopLevel = false, WindowState = FormWindowState.Maximized }; this.Parent.Controls.Add(frm); frm.Show(); this.Parent.Controls.Remove(this); } } catch (Exception) { } }