Disable double click event on cells in datagridview

topsykretts

Well-known member
Joined
Dec 22, 2011
Messages
47
Programming Experience
Beginner
My question is simple. How to disable double click event on cells in datagridview?, because when it's enabled my cells become editable.
I am trying with:

VB.NET:
  Private Sub DataGridView1_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellDoubleClick

        DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect

    End Sub
But after few double clicks it again become editable.
 
Try handling the CellMouseDoubleClick event. You could also consider setting the EditMode property to EditProgrammatically.

Actually, you're right. Thank you very much, I resolve this by:
VB.NET:
Private Sub DataGridView1_CellMouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDoubleClick
        
DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
    End Sub
And by changing Edit Mode of DGV toEditProgrammatically.
Thank you very much again.
 
Back
Top