private void btnAdd_Click(object sender, EventArgs e) { var addEditStudent = new AddEditStudent(); addEditStudent.FormClosing += AddEditStudent_FormClosing; addEditStudent.ShowDialog(); }
private void btnEdit_Click(object sender, EventArgs e) { if (dgvBook.SelectedRows.Count == 0) { MessageBox.Show("Proszę zaznacz ucznia, którego dane chcesz edytować."); return; } var addEditStudent = new AddEditStudent( Convert.ToInt32(dgvBook.SelectedRows[0].Cells[0].Value)); addEditStudent.FormClosing += AddEditStudent_FormClosing; addEditStudent.ShowDialog(); }