private void drgvFood_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { Food selectedFood = drgvFood.Rows[drgvFood.CurrentCell.RowIndex].DataBoundItem as Food; if (selectedFood == null) { return; } FormFoodAddEdit formNewRestaurant = new FormFoodAddEdit(this, FormFoodAddEdit.ACTION_TYPE.VIEW); formNewRestaurant.SetDataForm(selectedFood); formNewRestaurant.ShowDialog(); }
private void btnEdit_Click(object sender, EventArgs e) { Food selectedFood = drgvFood.Rows[drgvFood.CurrentCell.RowIndex].DataBoundItem as Food; if (selectedFood == null) { MessageBox.Show("Bạn phải chọn món ăn !!!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } FormFoodAddEdit formNewRestaurant = new FormFoodAddEdit(this, FormFoodAddEdit.ACTION_TYPE.EDIT); formNewRestaurant.SetDataForm(selectedFood); formNewRestaurant.ShowDialog(); }
private void btnAdd_Click(object sender, EventArgs e) { FormFoodAddEdit formNewRestaurant = new FormFoodAddEdit(this, FormFoodAddEdit.ACTION_TYPE.CREATE); formNewRestaurant.ShowDialog(); }