Windows and Forms

A

Allen Maki

Hi Everybody,

I need your help.



I have MS Visual Studio .NET 2003. I noticed that if I added a context menu
to a form. It will not work, unless you add the line:



This ->ContextMenu = this->contextMenu;



manually.



Can anybody tell me why?



IF you have the book named:

Microsoft visual c++ .net step by step made by Microsoft press, you
find this example in chapter 16 page 317
 
B

Ben Voigt

Allen Maki said:
Hi Everybody,

I need your help.



I have MS Visual Studio .NET 2003. I noticed that if I added a context
menu to a form. It will not work, unless you add the line:



This ->ContextMenu = this->contextMenu;



manually.



Can anybody tell me why?

You can usually assign that using the designer, but yes it's necessary to
assign a specific context-menu. This is because you could store multiple
context menu controls on a form, but one is for the form itself, one is a
right-click menu for a grid, one for a text-box, etc. The runtime has no
way of knowing how they pair up until you tell it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top