private void btnAddNew_Click(object sender, EventArgs e) { using (inputForm = new InputForm(this)) { inputForm.prepareAdding(); inputForm.ShowDialog(); } }
private void btnEdit_Click(object sender, EventArgs e) { if (dgCD.SelectedRows.Count > 0) { var index = dgCD.SelectedRows[0].Index; var list = (BindingList <CD>)dgCD.DataSource; var cd = list.ElementAtOrDefault(index); using (inputForm = new InputForm(this)) { inputForm.prepareEditing(cd); inputForm.ShowDialog(); } } else { MessageBox.Show("No rows selected"); } }