Hi guys. I'm looking for develop right click menu for data grid view control. I mean When I right click on data grid view I want to show right click menu. I find a way. But I need aditional help. I know How to add right click menu. But I don't know how to add code to show specific form when I click on right click menu item.

If e.Button = MouseButtons.Right Then
            Dim m As New ContextMenu()
            m.MenuItems.Add(New MenuItem("New Customer"))
            m.MenuItems.Add(New MenuItem("Edit Customer"))
            m.MenuItems.Add(New MenuItem("Delete Customer"))
            m.MenuItems.Add(New MenuItem("Instant Report"))
            Dim currentMouseOverRow As Integer = MetroGrid1.HitTest(e.X, e.Y).RowIndex

            If currentMouseOverRow >= 0 Then
                m.MenuItems.Add(New MenuItem(String.Format("Do something to row {0}", currentMouseOverRow.ToString())))
            End If
            m.Show(MetroGrid1, New Point(e.X, e.Y))
        End If

Guys help me with code examples. I appreciate it.

1 Year
Discussion Span
Last Post by Sashika_1

You got to implement a Click event for the MenuItem clicked.

Edited by ddanbe: Delete of wrong sentence

Votes + Comments
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.