PDA

View Full Version : Problems with MainMenu when using Smartphone 2003 SDK & VB.NET


Mike Temporale
08-26-2003, 04:55 PM
Has anyone else played with the new Smartphone 2003 SDK using VB.NET??

For some reason I can't build a menu for the left hot key. I can for the right, but of the left key has any children, it will fail when deploying with the following error:

An unhandled exception of type 'System.NotSupportedException' occurred in System.Windows.Forms.dll

It fails on the system generated line

me.Menu = Me.MainMenu1

Am I doing something wrong here? of is there an issue with the using the main menu on the left softkey?

Robert Levy
08-26-2003, 05:16 PM
This is by design. Here's a snippet from the SDK's documentation.

"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 submenus.
Note The .NET Compact Framework does not enforce these restrictions at design time but does throw an NotSupportedException at run time.
Visual Studio.NET automatically adds a MainMenu component to your form when you create Smartphone and Pocket PC applications. The component, however, is not automatically added to child forms.

The Compact Framework does not limit the number of submenu items you can have or the number of nested menus, but for best practices follow Smartphone UI guidelines as described in "Designing User Interfaces for Smartphone" in the Smartphone Guide.

At run time, you cannot delete a top-level menu item. However, you can set MenuItem.Enabled to false and set MenuItem.Text to an empty string to make a menu item appear invisible."

Mike Temporale
08-27-2003, 02:09 AM
Thanks! I looked in the SDK Help while I was at the cottage last week, however I'm guessing I had too many glasses of wine and that's why I couldn't find the answer. :drinking: