1
votes

I have a DataGridView with 4 columns.

When a user double clicks the row, I want to revtrieve data from the 1st column of the clicked row.

    private void ticketsDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
    {
        MessageBox.Show("Row " + e.RowIndex); // gets me the row selected

    }

How can I get the column for the selected row?

1

1 Answers

4
votes

Look at DataGridView.Rows Property

try this on doublic click event.

DataGridViewRow row =dataGridView.Rows[0];

string someStringColumnValue = (string)row.Cells[0].Value;

Ref: C# - Lambda syntax for looping over DataGridView.Rows