Creating ContextMenu in Visual Basic .NET

Last Updated: March 19, 2020

Context Menus are displayed when user right click on the control. In this example we will add ContextMenuStrip to the form by dragging the ContextMenuStrip from Toolbox and drop it on the Form

Now I am going to add three menu called Copy, Paste and Close with ShortCutKeys

How to display Context Menu?
You have to set the ContextMenuStrip property of the Form to ContextMenuStrip1

This is how you can see the ContextMenu when you right click on the Form

And this is the code used

Public Class Form1
Private Sub CopyToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CopyToolStripMenuItem.Click
        MessageBox.Show("Copy Button Clicked")
    End Sub
End Class