private void btnAdd_Click(object sender, EventArgs e) { GetEmedCorpList(); FormHisCorpCreate frm1 = new FormHisCorpCreate(dsEmedCorpList0); frm1.flag = "ADD"; frm1.ShowDialog(); bindingDsEnterPriseMapList(); ItemFilter(); }
private void btnEdit_Click(object sender, EventArgs e) { DataRow dr = gridView3.GetDataRow(gridView3.FocusedRowHandle); if (dr != null) { GetEmedCorpList(); FormHisCorpCreate frm1 = new FormHisCorpCreate(dsEmedCorpList0); frm1.flag = "MODIFY"; frm1.code = dr["HIS_ORG_ID"].ToString(); frm1.fullname = dr["FULL_NAME"].ToString(); frm1.easyname = dr["EASY_NAME"].ToString(); frm1.orgid = dr["org_id"].ToString(); frm1.process = dr["PROCESS_FLAG"].ToString(); frm1.ShowDialog(); bindingDsEnterPriseMapList(); ItemFilter(); //原选定foreach //foreach (DataGridViewRow row in this.dgvEPIDCompare.Rows) //{ // if (row.Cells["CODE"].Value.ToString() == frm1.code) // { // this.dgvEPIDCompare.CurrentCell = this.dgvEPIDCompare["CODE", row.Index]; // } //} //修改为如下 for (int i = 0; i < this.gridView3.RowCount; i++) { DataRow drow = gridView3.GetDataRow(i); if (drow["HIS_ORG_ID"].ToString() == dr["HIS_ORG_ID"].ToString()) { this.gridView3.FocusedRowHandle = i; } } } }