> On Sat, 28 Aug 2004 10:27:55 +0200, Bezeqint wrote:
Hello. I'm looking for an example of using Dim as Menu in VB6.
Any help would be appreciated.
Thanks !
What exactly are you trying to do? Dynamic menus? Or just setting
references to existing menus?
Reference:
Dim x As Menu
Set x = mnuFoo
Dynamic:
c = c + 1
Load mnuFooBar(c)
mnuFooBar(c).Caption = "blah"
[Dynamic menus must be created as an array in the menu editor.]
To add to your dynamic case, you could Dim As Menu in order to iterate
the control array of menus (named mnuFooBar for your example) to get at
particular properties of each menu item in the control array...
Dim mnu As Menu
For Each mnu In mnuFooBar
Debug.Print mnu.Index & " - " & mnu.Caption
Next
or, depending on how dynamic everything is, using it to filter down to a
particular menu item. For example, if the Caption for one of the items
is "Can you see me?", the following could be used to test it's Visible
property...
Dim mnu As Menu
For Each mnu In mnuTop
If mnu.Caption = "Can you see me?" Then
If mnu.Visible Then
Debug.Print "I can see it!"
Else
Debug.Print "It is invisible!"
End If
End If
Next
Rick - MVP