Jump to content

NotSupportException in Menu control


Recommended Posts

Guest bdmoore
Posted

Hi,

I've got a strange problem with an app I am developing. The following line (from the Windows Forms Designer auto generated section!) throws a NotSupportedException:

this.Menu = this.mainMenu1;

I created the menu using the form designer and so would expect it to work! I'll try creating it from scratch instead but if anyone could tell me where I'm going wrong it would be much appreciated!

Cheers :)

Guest Habanero
Posted

The MenuItem class has the following restrictions:

- You can have no more than two top-level menu items.

- Only the second top-level menu item, on the right side of the form, can have sub-menus.

These aren't enforced at design time but will cause that exception at run-time.

Hope this helps.

Habanero

Guest bdmoore
Posted

@Habanero,

Thanks for that :)

I was trying to put a sub menu on the left hand menu, that must have been causing the problem!

Seems a bit of a stupid restriction tho, would like to know the reasoning behind that decision :?

Cheers :D

  • 3 weeks later...
Guest ultimasnake
Posted

hmm that was my problem too.. never would have found it out myself.. kinda sucks though.. either Evc++ can do it... or some programs found a way around this problem (smartexplorer)

Guest bdmoore
Posted

You only get this problem with .Net CF apps as the framework enforces MS's rules / standards. With EVC++ you can do what you want - I just don't know it!!

And yeah it does kinda suck! :lol:

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.