private void btnEditSelected_Click(object sender, EventArgs e) { if (dataGridView2.Rows.Count > 0) { var addEdit = new AddEditMovieForm(this, OperationType.Edit); addEdit.ShowDialog(); addEdit.Dispose(); } }
private void dataGridView2_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 46) { if (dataGridView2.Rows.Count > 0) { int id = (int)dataGridView2.SelectedRows[0].Cells[1].Value; pbMovieImage.Image = null; store.DeleteMovie(id); } } else if (e.KeyValue == 13) { if (dataGridView2.Rows.Count > 0) { var addEdit = new AddEditMovieForm(this, OperationType.Edit); addEdit.ShowDialog(); addEdit.Dispose(); } } }
private void button1_Click(object sender, EventArgs e) { var addEdit = new AddEditMovieForm(this, OperationType.Add); addEdit.ShowDialog(); }