|
-
Apr 25th, 2002, 11:03 AM
#1
Thread Starter
Addicted Member
Hiding menus
This is probably easy to solve, but i cant figure it out.
How do you hide the menu, and when i mean THE menu, i mean as in all the menus at the top of a form.
I have an MDI form with a menu at the top:
File Edit Options Window Help
I just want to hide it or disable it until the user has logged in.
I was going to do a for loop something like this:
VB Code:
For Each Menu In Me.Menus
DoEvents
Menu.Visible = False
Menu.Enabled = False
Next
-
Apr 25th, 2002, 11:29 AM
#2
The only way I could get this to work, without individually listing each menu item,
was to put the entire menu in an array. I initially had the same menu structure on
my test project that I think you have, which is/was:
mnuFile
mnuEdit
mnuOptions
mnuWindows
mnuHelp
I put the menu in an array, by changing the name (The Captions remained File Edit Options Windows Help) of mnuFile, mnuEdit, mnuOptions, mnuWindows, mnuHelp to mnuFile(0) for File, mnuFile(1) for Edit, mnuFile(2) for Options, mnuFile(3) for Windows, mnuFile(4) for Help. Since you don't code the click event of the top level menu items, but rather code the click event of the sub menu items, this doesn't pose a problem, and allows this
code to work.
VB Code:
Private Sub Form_Load()
On Error Resume Next
Dim i As Integer
For i = 0 To mnuFile.Count
mnuFile(i).Enabled = False
Next
End Sub
Hoky? Yeah, a little bit, but it does get the job done without having
to individually list the various menus.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|