>How can I Loop the Menus in VB?
>
>I want a class that I have created to Loop through the Menus and enable/disable menu bars. I do this in VFP fairly easily. Any code out there that shows me how to do this in VB?
>
>File
>---Print
>---Print Setup
>---
>---Exit
>
>Loop through this in code to disable the items under File that should not be enabled for a form that has no print routine.
You can use this code to cycle through menu items:
Private Sub Command1_Click()
Dim ctlX As Control
For Each ctlX In Me.Controls
If TypeName(ctlX) = "Menu" Then
MsgBox ctlX.Name & ": " & ctlX.Caption
End If
Next
End Sub
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com