开发者

Windows forms designer broken in VS2010?

We've recently upgraded from VS2008 to VS2010. The conversion of our vb.net Windows Forms app went well, but we're now having big problems with the forms designer.

Pretty much any change to the layout of a form (sometimes just a solution rebuild) will work once, but on recompile, the IDE designer refuses to display the form, the error message being a null-reference exception (with no details as to wh开发者_如何学Pythonat).

Closing and restarting VS2010 will cure it, but only for one compile cycle - and it's obviously not practical to close and reopen every time. Closing and reopening the form does not fix it.

We had these very occasionally before, if there was something wrong in the form's load event, or more rarely for random reasons, but since VS2008 SP1 this was never serious.

Whereas now with VS2010, it's now every form, every compile.

It's completely unworkable, and we've had to revert to VS2008 for winforms dev.

Any suggestions would be greatly appreciated..


You can debug design mode:

  • In project properties, in the debugger tab, set the name of the executable to devenv.exe.
  • Run/debug the project: this launches a 2nd copy of Visual Studio
  • Use the 2nd (being debugged) copy Visual Studio to open the form in design mode

You may find more detailed information on the 'net, by Googling for 'debug design mode'.


Is your project Targets to .Net Framework 4 Client Profile or .Net Framework 4 ?

If you are not intentionally targeting to .Net Framework 4 Client Profile then change it to .Net Framework 4 you have a fair enough chance.

If, that was not helpful. Please do the above procedure as ChrisW said. That is the last option.


we faced the same problem. The reason ist, that the Handles statements are not converted according the control name, but in capital letters.

However the controls themselves still contians the original correct name in lower case or mixed. They also do this way in the designer.vb code. You have to correct alle handles in the .vb code to match the name in the designer.vb code of the same form.

A (fast) workaround is as follow. a) Load the defective project. b) Try to open a form c) Press F7 to open the code d) Replace all Handles to 'handles (search and replace, it works only form by form this way) e) start a build f) replace all 'handles to Handles g) now the form should open

Unfortunately this works only form by form as VS 2010 'chockes' loading too many forms at a time.

We are not taking any responsibility for the functionality not for eventual damage of your code using this suggestion!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜