Adding a horizontal separator in a MenuStrip

Malfist picture Malfist · Feb 2, 2009 · Viewed 50k times · Source

I can't seem to find any way to add a horizontal separator in a MenuStrip. Visual Studio complains Cannot add ToolStropSeparator to MenuStrip.

Any idea's how I can do this?

Answer

Gerard picture Gerard · Dec 3, 2010

In the space between the two fields you want separated by the divider, type:

-

then hit enter (in the designer)

If you need to do this programmatically you can use the same trick:

contextMenu1.MenuItems.Add(new MenuItem("-"));