private void btnAdd_Click(object sender, EventArgs e) { NewUnitForm addUnit = new NewUnitForm(null); if (addUnit.ShowDialog() == DialogResult.OK) { UpdateUnitList(); } }
private void btnEdit_Click(object sender, EventArgs e) { if (dgvDetail.SelectedRows.Count >= 1) { UnitExt extObj = (UnitExt)dgvDetail.SelectedRows[0].Tag; if (extObj.IsUserAdded == 1) { NewUnitForm addUnit = new NewUnitForm(extObj); if (addUnit.ShowDialog() == DialogResult.OK) { UpdateUnitList(); } } else { MessageBox.Show("对不起,只能编辑用户自定义的单位!"); } } }