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