Windows Develop Bookmark and Share   
 index > Windows Forms Designer > How do I unassociate the designer from a class?
 

How do I unassociate the designer from a class?

I have a c# class that is associated with the designer so that when I click on the code file, Visual Studio tries to open the class in the designer. I would like to disable this behavior and have the class open directly in the source editor.

What causes a .cs file to open in the designer and how do I disable it for an individual file?

This is in VS 2008 professional.

Thanks,
Ray
RainmanRam  Saturday, May 02, 2009 2:35 PM
Hi,
Can you please give some more idea about your issue?

-- Thanks Ajith R [Mark as Answer if it is Helpful.]
Ajith R Nair  Thursday, May 07, 2009 7:32 AM
Hi Ray,

If the base class of a class has a designer, VS will open the class in the CSharp Form Editor by default. Right click on the .cs file in Solution Explorer and choose "Open With" command. In the Open With dialog, select CSharp Editor and click the Set as Default button and click the OK button.

Note that this setting takes effects to the Visual Studio IDE, i.e. thissetting applies to anysolution opened in the Visual Studio IDE. Unfortunately, there's no way to set the setting for an individual file.

In your practice, if the designer is written by yourself, you can remove the DesignerAttribute from the base class of your custom control so that the class in question will be opened in the source editor by default.

Sincerely,
Linda Liu
Linda Liu  Thursday, May 07, 2009 9:45 AM

You can use google to search for other answers

Custom Search

More Threads

• How do I flag a property as not serializable
• Is it possible to create short cut keys for each of my tab pages in my tab control?
• Unwanted Focus to FlowLayoutPannel
• A simple question regarding Custom UserControl
• Form Designer Blank
• How do you implement the layout commands for IDesignerHost?
• Changing parent at DesignTime inside inherited control
• Form Designer Questions
• VS Crashes upon exit
• Code generation with CodeDom