Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you copy menus from one form to another?

Status
Not open for further replies.

JohnInDC

Programmer
Joined
Aug 26, 2005
Messages
20
Location
US
I've made a help menu using Menu Editor in VB 6.0. I would like all of my forms to have the same help menu. Is there a way to copy this menu to my other forms?

I can copy the event handler code that gets executed by the help menu, but since the menu can't be highlighted on the object view of the form, I don't see a way to copy and past it.

Is my only option to build each form's help menu individually through the Menu Editor?

Thanks,
John
 
I found a manual way of doping this.

If you open the .frm file with Notepad, you'll notice that there is a bunch of header information. In the section where menu items are added, you can copy/paste to the other .frm files that you want the controls copied to.

Before doing this, make sure you have a good backup of the source code files.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Wow! That is super cool! I had no idea you could do something like that!

Editing the code directly like that opens all kinds of possibilities. Though you're right, I better back everything up before I start playing around with it... I remember when I first discovered that I could manually edit the windows registry. <:-)

Thanks,
John
 
Sadly, the problem with this method is that it is not dynamic. If you copy the menu structure to several forms, and then change the menu of the original, you'll need to re-copy the menu to the other forms.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Oh, you're right. That would be great if the changes would propagate.
 
While it is indeed super cool in this case in that it handles a pernicious problem in VB, it's not to be recommended in general. I wouldn't get too enthusiastic about the idea of directly editing the text files. George's words "manual" and "doping" need to be taken to heart! :) But in this case, manually (or programmatically, if you will) copying the appropriate area of the text file beats the heck out of going through Menu Editor. The ME is tedium enough without also being repetitive tedium!!!

Nice idea, George.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top