Windows Develop Bookmark and Share   
 index > Windows Forms Designer > DesginHost problem with droping ToolStrip, StatusStrip and MenuStrip from toolbox
 

DesginHost problem with droping ToolStrip, StatusStrip and MenuStrip from toolbox

Does anyone know whyToolStrip toolbox item fails with the below exception messagewhen
drop it on the design surface from toolbox in the DesignHost sample?

Exception message:
The control System.Windows.Forms.ToolStrip has thrown an unhandled exception in the designer and has been disabled.
Exception: Object referenced not set to an instance of an object
StacK trace:
at System.Windows.Forms.ToolStrip.OnHandlerCreated(EventArgs e)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)

Thanks in advance.
Tabu67  Wednesday, February 18, 2009 3:34 PM
Hi,

The "Object reference not set to an instance of an object" exception usually happens when there is an attempt to reference a null object.

But unfortunately, I am not able to reproduce this issue when drop the toolstrip to the form. Could you give me information about this issue?

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Sunday, February 22, 2009 12:05 PM
Hello,

Download the DesignerHost.exe package from http://support.microsoft.com/?id=813808.
Add the following lines in ToolboxPane.cs (line 50):

private Type[] windowsFormsToolTypes = new Type[] {
...
typeof(System.Windows.Forms.MenuStrip),
typeof(System.Windows.Forms.ToolStripContainer),
typeof(System.Windows.Forms.ToolStrip),
typeof(System.Windows.Forms.StatusStrip)
}

Run the application, then click on"File Menu"->"New" and drag a MenuStrip or ToolStrip control from
"WindowsForms" toolbox tab. A MessageBox with the error shown in prevoius post is displayed.

Thanks.

Tabu67  Monday, February 23, 2009 8:58 AM
I'm experiencing exactly the same issue. Can anyone offer a solution? Thanks a lot!
sharp knight  Wednesday, June 10, 2009 4:13 AM

You can use google to search for other answers

Custom Search

More Threads

• Ressources embedded problem with a compilation on the fly
• Inheriting Designer
• To see description in Labels
• Resize application forms to fit all user monitors...
• Using interface as a property type?
• Designer Error: One or more errors encountered while loading the designer. The errors are listed below. Some errors can be ...
• How to create lable with rounded corners ?
• Is it possible expose all properties of user control with a little work
• Bug in Datagridview designer? Columns disappears
• Preprocessor Macros with Windows Form Designer Compiler