bitbonk
bitbonk

Reputation: 49619

VS 2008 Windows Forms make "View Code" the default for UserControls

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?

Upvotes: 7

Views: 777

Answers (2)

NascarEd
NascarEd

Reputation: 1390

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
{
}

Upvotes: 1

Rhys Jones
Rhys Jones

Reputation: 3993

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.

Upvotes: 7

Related Questions