C# Menu Toolstrip Get Status

Posted by Yeti on Stack Overflow See other posts from Stack Overflow or by Yeti
Published on 2010-03-23T14:34:52Z Indexed on 2010/03/23 14:43 UTC
Read the original article Hit count: 617

Filed under:
|
|

So I have a project where there is some automatic initialization going on through some classes that are created automatically as global variables (deah they are static instances). At a point inside this (it has no relation with the C# GUI for the user, so it isn't derived from any C# class) I need to see if a flag is set or not.

I use toolstrip menu with checked and unchecked status in order to set or unset the flag. The problem is that I have difficulties to see if the flag is checked or not from this static class. My class is inside a different project/namespace and a DLL is created what later is linked to the GUI of the application. The GUI depends from this Manager class so making the Manager class to depend from the GUI is not an option. Nevertheless, I should be able to see its state knowing its name or through some other means. I have tried the following:

if(Application.OpenForms[1].Owner.Controls["useLocalImageForInitToolStripMenuItem"].Enabled)
{  };

Now the problem is that on the upper code snippet I get a nasty error. So how do I do this?

© Stack Overflow or respective owner

Related posts about c#

Related posts about toolstrip