프로그래밍

[vb.net] Datagridview CellMouseDown Rightclick Event

프로세스 천국 2013. 3. 14. 21:25

데이타그리드뷰에서 우클릭하면 셀이 선택이 되지 않는다.

 

    Private Sub dgv_CellMouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles dgv.CellMouseDown
        Try
            If e.Button = MouseButtons.Right Then
                dgv.CurrentCell = dgv(e.ColumnIndex, e.RowIndex)
            End If
        Catch ex As Exception

        End Try

    End Sub

 

 

Try 를 넣지 않으면 헤더를 클릭할때 에러가 남.