MenuItem.MenuItems.Clear NotSupportedException

When I call myMenuItem.MenuItems.Clear() during runtime, I get a
"An unhandled exception of type 'System.NotSupportedException' occurred in System.Windows.Forms.dll
Additional information: NotSupportedException"
This same error occurs if I call myMenuItem.MenuItems.Remove(menu_i) in a for loop at the point when myMenuItem.MenuItems.Count is down to 1. I can remove all menu items up until that point successfully.

I am using VS2005b2 with .NET CF 1.0.

Anyone have thoughts on why this would be?

[550 byte] By [jonfroehlich] at [2007-12-16]
# 1
In V1 , we've had a few places where we were throwing "NotSupported" exceptions. However, the scenario you mention is all supported and should not be throwing you that exception. Please post some code that can re-produce the problem and I'll take a second look.
SrivaniVEluri at 2007-9-9 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 2
me.MenuItem2.MenuItems.Clear

The above code will cause the problem. Has anyone found a work around for this? I have seen two suggestions. I cannot get either to work.

Suggestion one: Delete the menu and recreate it. How?

Suggestion two: Have two mainmenu objects on the form and just assign the proper one when needed.

Me.Menu = Me.MainMenu2

THis throws a "Native Error" that can not be caught in a Try

Tim

Eebel at 2007-9-9 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...