private void btnEdit_Click(object sender, EventArgs e) { if (this.dataGridView.CurrentCell == null) { return; } DataRow dr = (this.dataGridView.CurrentCell.OwningRow.DataBoundItem as DataRowView).Row; ACGroupEdit frm = new ACGroupEdit(short.Parse(dr["GroupID"].ToString())); if (frm.ShowDialog() == DialogResult.OK) { dr.RestData <Model_Service.MenJin.ACGroup>(frm.modelData); } }
private void btnAdd_Click(object sender, EventArgs e) { try { ACGroupEdit frm = new ACGroupEdit(0); if (frm.ShowDialog() == DialogResult.OK) { (this.dataGridView.DataSource as DataTable).AddRow(frm.modelData); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }