How to load and unload menus according to the type of user for that application??

Thanks in advance


  • [b][red]This message was edited by the walrus at 2005-2-2 3:58:40[/red][/b][hr]
    im not sure i understand your question, but i think what you're asking is how to make dynamic menus (as in File, Edit, View, Options) that change based on the situation. i assume you already know how to use the menu editor to make a static menu. the best way to make a dynamic menu in vb6, i think, is to set the Visible property for the menu options you want available. for example, if you have a File option with "Close File" as a dropdown option of the File menu and you only want the "Close File" option to be visible when a file is open, you can do [b]mnuCloseFile.Visible = False[/b] (where mnuCloseFile is the name of the "Close File" option) to hide the option and [b]mnuCloseFile.Visible = True[/b] to show the option. so basically, you'd have to put all possible menu options into the menu editor at design time, and at runtime select certain ones to show for certain situations.

    a second approach, that would allow for something closer to true dynamic menus (as in, you don't have to know all the options you'll need to put in the menu during design time), would be to add as many options to the menu as you think you'll need, and name them all the same name (like MenuOptions for instance), and give them all different Indexes. Then you could refer to each one as MenuOptions(x) and load any Caption you want into it (setting visible = false to the ones you don't end up using at the time). this approach would take a bit more work though, because you'd have to employ some awkward techniques to get your code to realize which option was clicked and what to do with it (considering all click events would be sent to the same sub). but the up side is it allows for a lot more dynamic possibilities in the menus.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion