Shell.MainMenuStrip is always null

Topics: CAB & Smart Client Software Factory
Aug 9, 2006 at 7:36 PM
originally posted by: bil_simser

I have one application that I'm building up from a winforms app. Everything works in other apps and all the reference apps but when I call RootWorkItem.UIExtensionSites.RegisterSite("MainMenu", Shell.MainMenuStrip); in AfterShellCreated, Shell.MainMenuStrip is always null?

I've compared other apps I've done, the reference apps, etc. Nothing special here, just a menustrip tossed onto a form with a deckworkspace. I can't trace to where the MainMenuStrip gets created but I think it's being created in ObjectBuilder by finding any object on the form of type MenuStrip.

Any ideas why it's null? I'm pulling my hair out tonight trying to figure out what's wrong. Makes it hard to register the menu for modifying it via modules ;)

Aug 9, 2006 at 9:22 PM
originally posted by: pyhavaim

Well It's null mostly beacause you does'nt have reference to it. In other words
Shell is reference to the ShellForm and any public method should be accessible.

First what you should do is to check if this MainMenuStrip is public ?

MainMenuStrip is still created in class constructor and ObjectBuilder is'nt not so "Magical" it just creates a object from a class and by creating it, it just run some tasks (strategies) where one of them is initializing the object.

Hope that helps...
Aug 9, 2006 at 9:36 PM
originally posted by: bil_simser

DOH! You know, my brain doesn't always work right. Thanks for the nudge. I had forgot to create a property to expose it.

Still, I was digging in at the quick start apps and none of them have a similar property, yet the MainMenuStrip value is there so I'm still trying to figure out where that's declared in those examples.