private void toolStripButton_Modify_Click(object sender, EventArgs e) { if (this.dgvMain.CurrentRow == null) { return; } if (this.dgvMain.CurrentRow.Index >= 0) { string ProductCode = this.dgvMain.SelectedRows[0].Cells[0].Value.ToString(); DataRowView drv = dgvMain.SelectedRows[0].DataBoundItem as DataRowView; DataRow dr = drv.Row; if (this.dgvMain.SelectedRows[0].Cells["colFixed"].Value.ToString() == "0") { frmProductEdit f = new frmProductEdit(dr); if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.BindData(); } } else { MessageBox.Show("此产品为系统内定,不可修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } }
private void toolStripButton_Add_Click(object sender, EventArgs e) { frmProductEdit f = new frmProductEdit(); if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.BindData(); } }