Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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 December 11th, 2006, 08:03 AM
Authorized User
 
Join Date: Nov 2006
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to make enable true for menuItem in C#

Hi
I have to create a menu & it's menuItem in MainForm of my application but when i Click on that menu item.i make it enable property false.
Now I want to Make enable property true for MainForm when Closes my SubForm.
Ok.
Send me idea how to do this.
Very Urgent

Thanks and Regards
Kumar Ashish
9350789189
__________________
Thanks
Kumar Ashish
[email protected]
 
Old December 15th, 2006, 05:32 AM
Friend of Wrox
 
Join Date: Feb 2006
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gaurav_jain2403
Default

You can do as follow. In the Main Form you write these lines in InitializeComponent() method:
MainMenu mainMenu1 = new MainMenu();
MenuItem mItem1 = new MenuItem("&Command");
mItem1.MenuItems.Add(new MenuItem("click here",new EventHandler(Commands)));
mainMenu1.MenuItems.Add(mItem1);
this.Menu = mainMenu1;
this.IsMdiContainer = true;

Then make another method as follow:
private void Commands(object sender,System.EventArgs e)
        {
Form2 frm2 = new Form2();
frm2.Show();
frm2.MdiParent = this;
this.Menu.MenuItems[0].Enabled = false;
        }
Till now it is fine. In the Sub form write this method:
private void Form2_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
this.MdiParent.Menu.MenuItems[0].Enabled = true;
        }
Hope this will solve your problem... All the best

Gaurav





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to control selected MenuItem programatically melania BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 9 November 13th, 2008 12:54 PM
Enable Update and Enable Delete check boxes don't mihabib ASP.NET 2.0 Basics 2 December 7th, 2006 11:44 AM
add menuitem in excel using VB jazzyJan Beginning VB 6 1 December 25th, 2005 03:46 AM
add menuitem in excel using VB jazzyJan Excel VBA 1 December 25th, 2005 03:34 AM
SmartNavigation="true" CraigJones ASP.NET 1.0 and 1.1 Basics 2 September 3rd, 2004 01:29 PM





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