private void btnEditPublisher_Click(object sender, EventArgs e) { if (dgvPublishers.Rows.Count == 0) { return; } var selectedRow = dgvPublishers.SelectedRows[0]; if (selectedRow == null) { return; } var publisherId = int.Parse(selectedRow.Cells[0].Value.ToString()); using (var updatePublisherForm = new InsertOrUpdatePublisherForm(publisherId)) { updatePublisherForm.ShowDialog(this); if (updatePublisherForm.DialogResult == DialogResult.OK) { ReloadPublishers(); } } }
private void btnNewPublisher_Click(object sender, EventArgs e) { using (var insertPublisherForm = new InsertOrUpdatePublisherForm()) { insertPublisherForm.ShowDialog(this); if (insertPublisherForm.DialogResult == DialogResult.OK) { ReloadPublishers(); } } }