Deleting a menu item

I am trying to delete a menu item from a Menubar associated with a window (Xojo 2018 r4 Windows 64-bit).

I can programmatically delete menu items from the MainMenuBar, but can’t get it to work with the Menubar associated with the window.

I have this code in the open event of the window

self.MenuBar = New MainMenuBar self.MenuBar.Remove("ViewMenu")

Also tried:

self.MenuBar = New MainMenuBar self.MenuBar.Remove(self.MenuBar.Child("ViewMenu"))

Is there a different way to reference the menu associated with a window?

Agh…I traced this code step-by-step and found that I reassigned the window menubar again somewhere else.

Sometimes you just have to plod through it.

It happens.