Google Analytics

Search This Blog

Monday, January 05, 2015

VB.NET: contextmenu add submenu

This article applies to VB.NET development on Microsoft .NET, tested on .NET framework 3.5.

Add submenu to System.Windows.Forms.ContextMenu.

Add the following codes to a form.

Dim listMenu As ContextMenu
listMenu = New ContextMenu

Dim mi As New MenuItem("Group 1")
mi.MenuItems.Add("Sub 1")
mi.MenuItems.Add("Sub 2")
listMenu.MenuItems.Add(mi)

No comments: