1

I've got some ToolStripMenuItem in a MDIParentForm, which I use to enable or disable depending of the status of the form I call clicking on them. If the form is enabled, the ToolStripMenuItem is disabled not allowing to open a new form like it's previously opened. The fact it's that I don't know why, but when I change the focus from one child form to another, the ToolStripMenuItem wich was disabled, become enabled again (and it shouldn't, because I haven't set it like that by code). I've have solved it using this:

Dim formPrevio As Form = Application.OpenForms.OfType(Of AltaUsuario).Where(Function(frm) frm.Name = "AltaUsuario").SingleOrDefault
If formPrevio Is Nothing Then
   'open it again
Else
    'Get the focus again
End If

But I'd like to know if there's any other way to solve this.

Carol
  • 553
  • 2
  • 10
  • 24

1 Answers1

2

Try calling a public function in the MDI Parent from the child form to disable the ToolStripMenuItem.

xpda
  • 15,585
  • 8
  • 51
  • 82
  • I solved it with the code I wrote. What I wanted to know if is there any easy way to do this (managed by the own app). Any way thanks for your help. – Carol Feb 19 '15 at 21:20