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())))
'MessageBox.Show("Hi")
End If
m.Show(MetroGrid1, New Point(e.X, e.Y))
End If
Guys help me with code examples. I appreciate it.