Private Sub viewmenu(ByVal sender As Object, ByVal a As EventArgs) 'Dim i = dgvexception.CurrentRow.Index Dim item = CType(sender, ToolStripMenuItem) Dim selection = CInt(item.Tag) Dim b = selection If b = 1 Then MsgBox(selection) End If If b = 2 Then MsgBox(selection) End If End Sub Private Sub dgvexception_MouseUp(sender As Object, e As MouseEventArgs) Handles dgvexception.MouseUp Try If e.Button <> Windows.Forms.MouseButtons.Right Then Return Dim cms = New ContextMenuStrip Dim item1 = cms.Items.Add("Edit") item1.Tag = 1 AddHandler item1.Click, AddressOf viewmenu Dim item2 = cms.Items.Add("View") item2.Tag = 2 AddHandler item2.Click, AddressOf viewmenu cms.Show(Me.dgvexception, e.Location) Catch ex As Exception End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)