How can I disable all MenuItems in a Form

mcerk

Regular
Joined
Nov 1, 2004
Messages
78
I'd like to disable all MenuItems (menu File, Edit, View, Help, etc..)

I have a function which disables all controls in a container:
Visual Basic:
'Function that Disables or Enables all controls in a container control
Public Sub EnableDisableObject(ByVal Enable As Boolean, ByVal Container As Control)
  Dim Control As Control
  For Each Control In Container.Controls
    Control.Enabled = Enable
  Next
End Sub

but the problem is that MenuItem is not a controll. How can I do it?

tx a lot

matej
 
Instead of doing all of the menu items. All you have to do is set enable to false on the top level items.

me.mnuFile.enabled = false
...etc

Hope this helps
 
SonicBoomAu said:
Instead of doing all of the menu items. All you have to do is set enable to false on the top level items.

me.mnuFile.enabled = false
...etc

Hope this helps
I believe that that is exactly what the code provided does. Enumerates through all the top level menus in MainMenu1 and sets their enabled property to false.
 
My Bad.

I thought (my big mistake) that it loop through all the menu items not just the top level. Well you learn something new every day.
 
Back
Top