private void btSelect_Click(object sender, EventArgs e) { if (dgList.CurrentRow == null) { return; } object objWaterUserID = dgList.CurrentRow.Cells["waterUserNO"].Value; if (objWaterUserID != null && objWaterUserID != DBNull.Value) { if (strFormType == "1") { frmWaterUserSearchAll frm = (frmWaterUserSearchAll)this.Owner; frm.strSelectWaterUser = objWaterUserID.ToString(); } this.DialogResult = DialogResult.OK; if (strFormType == "2") { frmWaterUserSearchAll_CanModify frm = (frmWaterUserSearchAll_CanModify)this.Owner; frm.strSelectWaterUser = objWaterUserID.ToString(); } this.DialogResult = DialogResult.OK; } else { mes.Show("获取用户号失败,请重新选择!"); return; } }
private void dgList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } if (e.RowIndex == dgList.Rows.Count - 1) { return; } string strWaterUserName = "", strWaterUserAddress = ""; object objWaterUserID = dgList.Rows[e.RowIndex].Cells["waterUserNO"].Value; if (objWaterUserID != null && objWaterUserID != DBNull.Value) { object objWaterUserName = dgList.Rows[e.RowIndex].Cells["waterUserName"].Value; if (objWaterUserName != null && objWaterUserName != DBNull.Value) { strWaterUserName = objWaterUserName.ToString(); } object objWaterUserAddress = dgList.Rows[e.RowIndex].Cells["waterUserName"].Value; if (objWaterUserAddress != null && objWaterUserAddress != DBNull.Value) { strWaterUserAddress = objWaterUserAddress.ToString(); } frmWaterUserSearchAll frm = new frmWaterUserSearchAll(); frm.strWaterUserID = objWaterUserID.ToString(); frm.strWaterUserName = objWaterUserName.ToString(); frm.strWaterUserAddress = strWaterUserAddress; frm.ShowDialog(); } }