Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
how can i add a sub menu on my existing menu option
heres my code;

VB
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


the code is good and i wanted to add a sub menu on my "view" option
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900