private void toolStripButton_Add_Click(object sender, EventArgs e) { frmProductEdit f = new frmProductEdit("add"); f.Owner = this; if (f.ShowDialog() == DialogResult.OK) { this.BindData("1=1"); } }
private void toolStripButton_Edit_Click(object sender, EventArgs e) { if (this.dgvMain.SelectedRows.Count > 0) { DataRow dr = ((DataRowView)dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].DataBoundItem).Row; frmProductEdit f = new frmProductEdit("edit"); f.Owner = this; f.drEdit = dr; if (f.ShowDialog() == DialogResult.OK) { this.BindData("1=1"); } } else { Logger.Info("请选择要修改的数据行"); } }