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