1

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?

Cocoa Dev
  • 9,361
  • 31
  • 109
  • 177

1 Answers1

4

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

Community
  • 1
  • 1
Niranjan Singh
  • 18,017
  • 2
  • 42
  • 75