DataGridView Row Click Event RRS feed

  • Question

  • I want to fire DataGridView row click event, but there is no such event in VS ( I couldn't find ) .
    I want when user clicks or double clicks on an entire row an event raises. CellContentClick event or RowHeaderClick events don't do that for me.Do they?
    Wednesday, May 9, 2012 8:50 PM


  • Hi mortaza.mkr,
    It’s true that the DataGridView doesn’t have row click or row double click event.
    I think what you want to do is that raising an event when the user click a selected row.
    To do this, you can handle CellClick event and check if the DataGridView.CurrentRow is selected.

    private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        DataGridView dgv = sender as DataGridView;
        if (dgv == null)
        if (dgv.CurrentRow.Selected)
            //do you staff.

    If there is anything unclear, please let me know.
    Beset Regards,

    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by mortaza.mkr Thursday, May 10, 2012 9:55 AM
    Thursday, May 10, 2012 6:29 AM