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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't call an empty MENU item?

Status
Not open for further replies.

MichaelRed

Programmer
Dec 22, 1999
8,410
US
I get an error on compiling a program. The error is on a line which "calls" one of the menu items. The Menu Item (currently) doesn't have any code in the click (the only) event. If I just put a comment in the Menu Item, it will compile w/o err.

I can also have "empty" subs in the general portion of the form's code module, and I can even place calls to the empty sub in the general section. BUT the mnuXXX_Click event cannot be empty if it is referenced in any code (w/o getting a compile error).

Help! I do NOT understand this behaviour! Is this documented?



MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Yes. If you dbl-click on a tool to create a sub. If you don't add any code (or comment) in the sub, VB just removes the sub. It thinks it will not be used, then it then is no longer available.
Just put in a single '
this will preserve the sub for future use. The door to life is never locked, but few have the knowledge to open it.
 
But ......

[tab]I DIDN"T create the thing, I just referenced it.
VB (menu editor) created it.

You CAN create - AND REFERENE empty subs you create by clicking on the "tool" to create a new procedure.

I SEE the result. I am curious about WHY this is (the difference between menu subs and general subs. I would ALSO like to know how to find the documentation which says it is different (and possibly explain it?). But mostly, I would like to understand the docs system better, so I would be able to track this behaviour to it's "source"


MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Try the MSDN library. Either on line, or if you get a subscription. You can find it on MS site.

Hope this helps :) The door to life is never locked, but few have the knowledge to open it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top