The
MenuItem
constructor doesn't have an overload that accepts two strings - I think you need to review the overloads for the
MenuItem
class:
http://msdn.microsoft.com/en-us/library/system.windows.forms.menuitem.aspx[
^]
Beyond that, you probably need to have more info in the database. I would probably have the following schema:
int ID (unique identifier)
int ParentID
string Name
int Sequence
string Tooltip
This way, you can freely add menu items in any order, associate one or more with a given Parent menu item's ID, and cause them to appear in any desired order. So You could have this:
ID PARENT NAME SEQ TOOLTIP
1 0 File 0 ""
2 1 Open 0 "Open an existing file"
3 1 Save 1 "Save the currently open file"
4 1 Exit 2 "Exit program"
5 0 Edit 1 ""
6 5 Copy 0 "Copy selected items to clipboard"
At this point you could create your menu in a more organized fashion in your C# code. A parentID of 0 would indicate a root-level menu item, and you could add additional columns that defined whether or not the item is checked, enabled, or is a divider.