Hi Allen,
I don't have the book so I can't say for sure, but I'm guessing you havecreated a ContextMenu object called contextMenu. To be able to use this ContextMenu object for anything useful, you need to attach it to a Control.
this->ContextMenu = this->contextMenu; says that the ContextMenu property of 'this' should point to the ContextMenu object called contextMenu.
It doesn't help that the ContextMenu property and ContextMenu class and contextMenu object is pretty much identical in name (note the lower casec in the object name).
On Mon, 19 Feb 2007 06:34:20 +0100, Allen Maki <al*******@sbcglobal.net>wrote:
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
--
Happy coding!
Morten Wennevik [C# MVP]