private void btnDelete_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("你確定欲刪除該餐點 " + detail.Name + " ?" , "警告", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { if (bll.HasTags(detail.ID)) { bll.RemoveTags(detail.ID); // Delete tags first. MessageBox.Show("附帶餐點標籤已刪除"); } if (bll.Delete(detail.ID)) // Then delete meals. { nbll.Delete(detail.NutrientID); MessageBox.Show("餐點已刪除"); bll = new MealBLL(); dto = bll.GetMeals(); ShowMeals(); this.textBox1.Clear(); } } }