Enabled/Desabled Main Item Menu when I click on mdi Child form

V

vladam

Plesa help me !

How can I enable/disable Menu Item (Menu is MainMenu for App.) on mdi
parent form when I click on some control in activ child form?
 
N

Nicholas Paldino [.NET/C# MVP]

vladam,

There are a few ways you can do this. The first would be to pass a
reference for the main form to the child form, and then have the child
modify the enabled/disabled state of the menu item when needed. Of course,
this means that you have to publically expose the menu items on the main
form.

The second option you have is to have an event that the child form
fires, that the parent form hooks up to. When the event is fired,
enable/disable the menu item.

Hope this helps.
 
V

Vlada

Ok Thanks !
But who options first or second the Best?


I have example problem

mainform
.....
public class frmMain : System.Windows.Forms.Form
{
public System.Windows.Forms.MainMenu mainMenu1;
public System.Windows.Forms.MenuItem mnuItExample;
public System.Windows.Forms.MenuItem mnuItem1;
.....
.....
private void mnuItem1_Click(object sender, System.EventArgs e)
{
MenuExample.frmChild newForm = new
frmChild(this);
newForm.Show();
}



childForm
.....
public frmChild(MenuExample.frmMain parent)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

// Veza sa roditeljem
this.MdiParent=parent;
.....

private void btnItem1_Click(object sender, System.EventArgs e)
{
// What wrong ?????
//this.MdiParent.(ButtonName).(PropertyName)
//frmMain.mainMenu1.mnuItem1.Enabled=false;
}



please halp me or sending any example.
I hope, that I don't born.
 

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

Similar Threads

MDI Forms using MainMenu 1
Main window location 4
MDI 2
Modal Form from a child form 2
MenuStrip Merge 0
ProgressBar while MDI child form is loading 4
MDI child for and it's menu 2
MDI Child menu 1

Top