DataGridView 마우스 오른쪽 버튼 가능 하게
Private Sub DataGridView1_CellMouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseClick
Dim cell As DataGridViewCell
Try
If e.Button = Windows.Forms.MouseButtons.Right Then
If e.ColumnIndex >= 0 And e.RowIndex >= 0 Then
cell = DataGridView1.Item(e.ColumnIndex, e.RowIndex)
DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
cell.Selected = True
ContextMenuStrip1.Show(Control.MousePosition.X, Control.MousePosition.Y)
End If
Else
DataGridView1.SelectionMode = DataGridViewSelectionMode.CellSelect
End If
Catch ex As Exception
End Try
End Sub