如何获得dataGridView某行指定单元格的值

2025-02-27 09:12:26
推荐回答(1个)
回答1:

// dgvFeeManagePay为dataGridView,_selectedRowIndex当前行行号
DataGridViewRow currentRow = this.dgvFeeManagePay.Rows[this._selectedRowIndex];
if (currentRow != null)
{
// 实体类
_feeManagePay = new FeeManagePay();
if (!string.IsNullorEmpty(currentRow.Cells["PayID"].Value + ""))
{
// PaIDiagnoseCode
_ feeManagePay.PaIDiagnoseCode = currentRow.Cells["PayID"].Value.ToString();
}
}