How do I add a ToolStripSeparator on a mainmenu bar programmactically?


Thanks.
lapuccaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ozymandiasConnect With a Mentor Commented:
Create a MenuItem.
Set its text to "-" and ASdd it to the Menu.

MenuItem menuitem = new MenuItem();
menuitem.Text = "-";
mymenu.Add(menuitem);

If you want it in a particular place then use :

mymenu.Insert(index, menuitem);

where index is the position in the list of existing menu items where you want the separator inserted.
0
 
ozymandiasCommented:
You just add a tool bar button but set its style to separator :

this.toolBarButton.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
0
 
lapuccaAuthor Commented:
Where is the adding part?  Also, how do I specify to insert this infront of the last menuitem which is the Exit.  Thank you.
0
 
lapuccaAuthor Commented:
I'm referring to the text menu part not the menustrip that contains the icon buttons.  Thanks.
0
All Courses

From novice to tech pro — start learning today.