我有一个包含 4 列的 DataGridView。
当用户双击该行时,我想从被点击行的第一列中检索数据。
private void ticketsDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
MessageBox.Show("Row " + e.RowIndex); // gets me the row selected
}
如何获取所选行的列?
请您参考如下方法:
在双击事件上试试这个。
DataGridViewRow row =dataGridView.Rows[0];
string someStringColumnValue = (string)row.Cells[0].Value;
