Viewing forms in design view error

L

LDD

I have VB.Net project that I'm working on.

This morning, when I loaded the project, and clicked on the main form for
the project to view in designer mode. I get the following error

Property accessor 'IsMdiContainer' on object
'System.Windows.Forms.Design.FormDocumentDesigner' threw the following
exception:'Specified cast is not valid.'


I've googled it. There is a sugestion to set the Copy Local property for the
System.Windows.Forms reference to false. and restart the project

When I do that, the controls on my form are no longer as they were. My form
is smaller. the menubar is gone. and my grid has shrunk, because the form
has shrunk. when I resize the form the grid resizes, but I don't know what
happen to the menu bar.

Any ideas why this is happeneing?
And maybe a solution?

LDD
 
C

Chris

LDD said:
I have VB.Net project that I'm working on.

This morning, when I loaded the project, and clicked on the main form for
the project to view in designer mode. I get the following error

Property accessor 'IsMdiContainer' on object
'System.Windows.Forms.Design.FormDocumentDesigner' threw the following
exception:'Specified cast is not valid.'


I've googled it. There is a sugestion to set the Copy Local property for the
System.Windows.Forms reference to false. and restart the project

When I do that, the controls on my form are no longer as they were. My form
is smaller. the menubar is gone. and my grid has shrunk, because the form
has shrunk. when I resize the form the grid resizes, but I don't know what
happen to the menu bar.

Any ideas why this is happeneing?
And maybe a solution?

LDD

Do you inherit from a sub form in this project? Do you do anything in
OnPaint override? Do you do some code in the Sub New()?

If yes to any of those the problem is probably in there. The designer
fires these events to display the form in the designer. You can stop
this from happening by wrapping the code causing the problem with:

If Not Me.DesignMode Then

End If

Just a thought
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top