How to add ContextMenuStrip at runtime in Vb.Net

By James J

Add ContextMenuStrip in button click event

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ContextMenu As New ContextMenuStrip()
Me.ContextMenuStrip = ContextMenu

Dim FirstTooltip As New ToolStripMenuItem()
Dim SecondTooltip As New ToolStripMenuItem()
Dim ThirdTooltip As New ToolStripMenuItem()

Text = "&First Item"
Text = "&Second Item"
Text = "&Third Item"

End Sub

> See below image

How to add ContextMenuStrip at runtime in Vb.Net  (4791 Views)