private void BtnNew_Click(object sender, EventArgs e) { //I'm passing the Mainform (itself) as a parentises DetailForm detailForm = new DetailForm(this); detailForm.ShowDialog(); }
private void DataGridViewBook_CellContentClick(object sender, DataGridViewCellEventArgs e) { //Pass a parameters the book's ID and this form DetailForm detailForm = new DetailForm(Convert.ToInt32(this.dataGridViewBook.CurrentRow.Cells[0].Value.ToString()), this); detailForm.ShowDialog(); }