Wrox Programmer Forums
BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer
This is the forum to discuss the Wrox book Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer by Rod Stephens; ISBN: 9780470596906
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 22nd, 2012, 07:30 PM
Authorized User
Join Date: Oct 2012
Posts: 32
Thanks: 1
Thanked 0 Times in 0 Posts
Unhappy Context Menu Not Working - Lesson 6 Ex 1

Hi all,

I am working through this book to teach myself C#. So far it is going well and apart from there being not enough explanation at times, i have been able to get everything to work.

However, now I am stuck.

I am working on the Simple Edit program and in lesson 6 ex 1 you have to add the tool strip container, toolstrips and the rich text box. After adding these items and setting their events etc, I ran the program and noticed that the context menu no longer works.

My first thought was that because i added the context menu before the container with the rich text box that the context menu order was behind them.

I deleted the context menu and re-added it after the container (with richtext box and toolstrips) but still when I run the program, the right click context menu doesnt work.

I am hoping i dont have to remake the program, although, better now than later.

Anyone know why the context menu would stop working after i add the container? Before adding, it was fine.
"These pretzels are making me thirsty"
Old October 22nd, 2012, 10:03 PM
Authorized User
Join Date: Oct 2012
Posts: 32
Thanks: 1
Thanked 0 Times in 0 Posts
Red face Solved

I couldnt help myself and continued to look through my program for the solution and found it.

In the Rich Text Box properties, I hadn't selected the context menu control in the ContextMenuStrip property.

Once selected, it works fine now.
"These pretzels are making me thirsty"
Old October 23rd, 2012, 11:26 AM
Rod Stephens's Avatar
Wrox Author
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts

Well done! It's always nice when someone answers their own question before anyone else gets to it

Related Tip: If you copy and paste a control like this from another Visual Studio session, be sure the controls to which it should be attached already exist where you paste it. That way it will often pick up the same connection. In this example, if you copy the ContextMenu first and then copy the RichTextBox, the RichTextBox may keep the connection to the ContextMenu. If you copy and paste the RichTextBox first, when you paste it the ContextMenu won't be there yet so the RichTextBox's ContextMenu property will reset to nothing.

Similarly if you copy and paste controls within the same project, you may sometimes face similar issues.

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)

Similar Threads
Thread Thread Starter Forum Replies Last Post
CH 15 Context Menu - Element Menu Items Razzy The Pug BOOK: Ivor Horton's Beginning Visual C++ 2005 2 November 9th, 2008 03:53 PM
Need help in context menu Hannibal General .NET 0 January 3rd, 2007 12:24 AM
Context Menu ? zoltac007 BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 June 7th, 2006 05:44 PM
Context Menu JMorrell Beginning VB 6 2 February 18th, 2005 09:33 AM
context menu mookashi Pro VB 6 0 March 16th, 2004 06:48 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.