/// <summary> /// 选择 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_OK_Click(object sender, EventArgs e) { Model_Bllb_station_tbs obj_Station; int iSelectedRows = 0; foreach (DataGridViewRow dgvr in dgv_Main.Rows) { if (dgvr.Cells[checkId.Name].EditedFormattedValue.ToString() == "True")//在获取datagridview中可编辑的列的值得时候 一定要用 EditedFormattedValue属性,此属性获取的是编辑以后数值 而value 和 FormattedValue返回的往往是编辑以前的数值 { obj_Station = new Model_Bllb_station_tbs(); obj_Station = PublicSetModel <Model_Bllb_station_tbs> .GetTByDataGridViewRow(dgvr); _list_Station.Add(obj_Station); iSelectedRows++; } } if (iSelectedRows == 0) { if (_isMore == true) { MsgBox.Error("请选择工位"); } else { MsgBox.Error("请选择一个工位"); } return; } if (_stationEvent != null) { _stationEvent(_list_Station); } }
private void tsbEdit_Click(object sender, EventArgs e) { if (dgvData.CurrentRow == null || dgvData.CurrentRow.Index == -1) { new PubUtils().ShowNoteNGMsg("请先选中行", 2, grade.OrdinaryError); return; } Form_MaterialRelManage f = new Form_MaterialRelManage(); f.obj_tbmr = PublicSetModel <T_Bllb_MaterialRelation_Tbmr> .GetTByDataGridViewRow(dgvData.Rows[dgvData.CurrentCell.RowIndex]); f._operationType = Common.Enum.OperationType.Edit; if (f.ShowDialog() == DialogResult.OK) { Query(); new PubUtils().ShowNoteOKMsg("编辑成功"); } }