private void btn_Add_Click(object sender, EventArgs e) { Form_EconomicDevAdd addOrEdit = new Form_EconomicDevAdd("add", null); addOrEdit.ShowDialog(); if (addOrEdit.DialogResult == DialogResult.OK) { OpreationDB("添加", addOrEdit.EconomicDevInfo); RefreshDataGridView(); } }
private void btn_Edit_Click(object sender, EventArgs e) { if (DataView.SelectedRows.Count < 1) { MessageBox.Show("请选中一行数据!"); return; } CADS.Model.EconomicDevInfoList EconomicDevInfo = new CADS.Model.EconomicDevInfoList(); EconomicDevInfo.ID = Convert.ToInt32(DataView.CurrentRow.Cells[0].Value); EconomicDevInfo.Agriculture = DataView.CurrentRow.Cells[1].Value.ToString(); EconomicDevInfo.Industry = DataView.CurrentRow.Cells[2].Value.ToString(); EconomicDevInfo.Service = DataView.CurrentRow.Cells[3].Value.ToString(); Form_EconomicDevAdd addOrEdit = new Form_EconomicDevAdd("edit", EconomicDevInfo); addOrEdit.ShowDialog(); if (addOrEdit.DialogResult == DialogResult.OK) { OpreationDB("编辑", addOrEdit.EconomicDevInfo); RefreshDataGridView(); } }