Yes, it is possible.
Assuming your MDI Child is Form2:
Public Class Form2
Private thisMenu As ContextMenu
Private Sub Form2_Load(sender As Object, e As System.EventArgs) Handles Me.Load
thisMenu = New ContextMenu
Dim item1 As New MenuItem("entry1", AddressOf Item1_Click, Nothing)
Dim item2 As New MenuItem("entry2", AddressOf Item2_Click, Nothing)
Private Sub Form2_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
If e.Button = MouseButtons.Right Then
#Region "Context Item Handlers"
Private Sub Item1_Click(ByVal sender As Object, ByVal e As EventArgs)
MsgBox("You clicked 'entry1'")
Private Sub Item2_Click(ByVal sender As Object, ByVal e As EventArgs)
MsgBox("You clicked 'entry2'")
Another thing you can do is just drag and drop a ContextMenuStrip onto the form from the designer. Then click on the form and set its ContextMenuStrip property to the menu you dropped on it. When you drop a menustrip it will show up in the component tray at the bottom of the designer. Click on it and you can edit the menu at design time.
That way you won't need to handle the forms mouse up event and won't have to deal with adding the items programmatically.
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...