You can add a submenu and another menu within the submenu through the designer or through code. Click on either of the following links to expand the steps for the designer or for the code.
To add multiple submenu items at design time
To add a submenu and another menu within the submenu at design time, complete the following steps:
To add multiple submenus programmatically
To programmatically add a submenu and another menu within the submenu, complete the following steps:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Imports C1.Win.C1Command |
To write code in C#
C# |
Copy Code
|
---|---|
using C1.Win.C1Command; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim ch As C1CommandHolder = C1CommandHolder.CreateCommandHolder(Me) Dim mm As New C1MainMenu |
To write code in C#
C# |
Copy Code
|
---|---|
C1CommandHolder ch = C1CommandHolder.CreateCommandHolder(this); C1MainMenu mm = new C1MainMenu(); |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.Controls.Add(mm) Dim mmenu As C1CommandMenu = CType(ch.CreateCommand(GetType(C1CommandMenu)), C1CommandMenu) |
To write code in C#
C# |
Copy Code
|
---|---|
this.Controls.Add(mm); C1CommandMenu mmenu = ch.CreateCommand(typeof(C1CommandMenu)) as C1CommandMenu; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
mmenu.Text = "&menu 1" mm.CommandLinks.Add(New C1CommandLink(mmenu)) |
To write code in C#
C# |
Copy Code
|
---|---|
mmenu.Text = "&menu 1"; mm.CommandLinks.Add(new C1CommandLink(mmenu)); |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim menuitem1 As C1Command = ch.CreateCommand() |
To write code in C#
C# |
Copy Code
|
---|---|
C1Command menuitem1 = ch.CreateCommand(); |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
menuitem1.Text = "Menu Item 1" 'add a new c1commandlink to the menuitem1 mmenu.CommandLinks.Add(New C1CommandLink(menuitem1)) |
To write code in C#
C# |
Copy Code
|
---|---|
menuitem1.Text = "Menu Item 1"; //add a new c1commandlink to the menuitem1 mmenu.CommandLinks.Add(new C1CommandLink(menuitem1)); |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim menuitem2 As C1CommandMenu = New C1CommandMenu() menuitem2.Text = "Menu Item 2" menu.CommandLinks.Add(New C1CommandLink(menuitem2)) |
To write code in C#
C# |
Copy Code
|
---|---|
C1CommandMenu menuitem2 = new C1CommandMenu(); menuitem2.Text = "Menu Item 2"; mmenu.CommandLinks.Add(new C1CommandLink(menuitem2)); |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim submenu1 As C1Command = ch.CreateCommand() submenu1.Text = "Submenu1" menuitem2.CommandLinks.Add(New C1CommandLink(submenu1)) |
To write code in C#
C# |
Copy Code
|
---|---|
C1Command submenu1 = ch.CreateCommand(); submenu1.Text = "Submenu1"; menuitem2.CommandLinks.Add(new C1CommandLink(submenu1)); |