By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,870 Members | 1,224 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,870 IT Pros & Developers. It's quick & easy.

Is there a Menu item maximum count?

P: n/a
Is there a maximum number of menu items that can be added to a single form?
If there is no maximum, that would help eliminate one possible source of the
problem.

I had six main menu items in the menu bar. After adding about 500 submenu
items to the first four main menu items, the last two menu items have now
disappeared. They are still there in the generated component code, but do
not appear in the designer. I suspect that something got hosed during the
process of adding submenu items, and dragging submenu items around.

Here is one of a dozen similar pieces of problematic-looking (to me) code:
Me.mnuServiceFosterTableCaretaker.Index = -1

Me.mnuServiceFosterTableCaretaker.Text = "Caretaker Type"

Any suggestions?

Dean Slindee


Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Redesign your app ;-)
"Dean Slindee" <sl*****@mindspring.com> schrieb im Newsbeitrag
news:eI*************@tk2msftngp13.phx.gbl...
Is there a maximum number of menu items that can be added to a single form? If there is no maximum, that would help eliminate one possible source of the problem.

I had six main menu items in the menu bar. After adding about 500 submenu
items to the first four main menu items, the last two menu items have now
disappeared. They are still there in the generated component code, but do
not appear in the designer. I suspect that something got hosed during the
process of adding submenu items, and dragging submenu items around.

Here is one of a dozen similar pieces of problematic-looking (to me) code:
Me.mnuServiceFosterTableCaretaker.Index = -1

Me.mnuServiceFosterTableCaretaker.Text = "Caretaker Type"

Any suggestions?

Dean Slindee

Nov 20 '05 #2

P: n/a
Hello Dean,

Thanks for posting in the group.

now the question is: You have six main menu items in the menu bar. After
adding about 500 submenu to the first four main menu items, the last two
main menu items disappear. You want to know whether there is a maximum
count number of menu item in .NET winform application, right?

Based on my experience, there is no such limitation in .NET programming. I
did a quick test on a C# winform application and add 500 sub menu items to
the first menu. It won't affect other menus. The sample code is:

public void AddMenu()
{
MainMenu mnuFileMenu = new MainMenu();
this.Menu = mnuFileMenu;
MenuItem myMenuItemFile = new MenuItem("&File");
mnuFileMenu.MenuItems.Add(myMenuItemFile);
MenuItem myMenuItemEdit = new MenuItem("&Edit");
mnuFileMenu.MenuItems.Add(myMenuItemEdit);
MenuItem myMenuItemOption = new MenuItem("&Option");
mnuFileMenu.MenuItems.Add(myMenuItemOption);
MenuItem myMenuItemHelp = new MenuItem("&Help");
mnuFileMenu.MenuItems.Add(myMenuItemHelp);
MenuItem myMenuItemTest = new MenuItem("&Test");
mnuFileMenu.MenuItems.Add(myMenuItemTest);

MenuItem myMenuItemNew1 = new MenuItem("&New");
myMenuItemFile.MenuItems.Add(myMenuItemNew1);
MenuItem myMenuItemNew2 = new MenuItem("&New");
myMenuItemEdit.MenuItems.Add(myMenuItemNew2);
MenuItem myMenuItemNew3 = new MenuItem("&New");
myMenuItemOption.MenuItems.Add(myMenuItemNew3);
MenuItem myMenuItemNew4 = new MenuItem("&New");
myMenuItemHelp.MenuItems.Add(myMenuItemNew4);
MenuItem myMenuItemNew5= new MenuItem("&New");
myMenuItemTest.MenuItems.Add(myMenuItemNew5);
for (int i=0; i< 500; i++)
{
MenuItem myMenuSubItemTest = new MenuItem("&TestSubMenuItem"+i.ToString
());
myMenuItemFile.MenuItems.Add(myMenuSubItemTest);
}
}

I am not sure of why you need so many menu items. However, based on my
experience, this is not a convenient UI for users. I think it is better if
you could redesign the structure of them to see if you could merge some
setting in forms or somewhere.

If the problem still happens on your side, could you please create a small
repro sample and email it to me? I will look into it on my side. You can
reach me by removing online from my email address here.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.