/// <summary> /// 添加按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InsertButton_Click(object sender, EventArgs e) { DishesEdit dishesEdit = new DishesEdit(); dishesEdit.ShowDialog(); this.DataRefresh(); }
private void UpdateButton_Click(object sender, EventArgs e) { //获取id后进入edit if (dataGridView.CurrentRow != null) { int index = dataGridView.CurrentRow.Index; string dishes_id = dataGridView.Rows[index].Cells["dishes_id"].Value.ToString(); DishesEdit dishesEdit = new DishesEdit(dishes_id); //退出编辑后刷新数据 dishesEdit.ShowDialog(); this.DataRefresh(); } else { MessageBox.Show("尚未选择数据"); } }