Domanda

I have MDI form Application, This application contains a menuStrip.
The menuStrip contains Save & save as.

What I want is, if there is an open file(MDI child) the save & save as will be enable, otherwise disable.
Note: I haven't any code to do that because I don't know where can I write the code.

Now, How I can write the code? and where ?

È stato utile?

Soluzione

on create child window,

 var newChild = new Form() { MdiParent = this };
 menuItem.Enabled = true;
 newChild.FormClosing += (s, o) => menuItem.Enabled = (this.MdiChildren.Length  == 1) ? false : true;
 newChild.Show();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top