views:

168

answers:

2

We have some UserControls that can not be designed. So the Windows Forms Designer in VS 2008 is pretty much useless and it takes some time until the designer throws the exception when accidentally doubleclicking the UserControl in the solution explorer. Is there a way I can make the designer open the C# code view when doubleclicking on a UserControl file?

+3  A: 

I set up all of my forms to open in code view by default by right clicking on one, and selecting the "Open With..." option. From the dialog that appears, select the "CSharp Editor" option and click the "Set as Default" button, then "OK".

You can do the same with user controls, and other types too.

Rhys Jones
Thank you very much! I've always overlooked that "Open with..." item.Works with VS2005.
dtroy
A: 

If you want to control this on a file by file basis, add the following attribute to your controls that you want to open in the source code editor:

[System.ComponentModel.DesignerCategory("")]
public class MyControl : Control
{
}
NascarEd