views:

339

answers:

2

Hello, I haven't done much work with .NET, so forgive me if this has a trivial solution.

The "problem" (more of an annoyance, really) is that the VC# IDE opens all files that have a class which inherits from System.Windows.Forms.Form in design-view, by default. The only exception being "*.Designer.cs" files.

Generally speaking, this is fine. However, if I have a partial class that implements some control handler code, this becomes quite an annoyance. When double-clicking on the source file, for instance, you are taken to the Winforms designer and presented with an empty form. Totally useless.

To get around this, you are required to right-click on the source file in question, and select "View Code" from the context menu.

My question is rather simple: is there any frigging way to get around this absurdity? If not, I'm wondering how people organize their UI-handling code.

Thanks!

A: 

Rather than right-click and view-code, I always use Doubleclick and it goes to the code page, focussed on the Form_load event, which can be left blank and ignored.

If you really want to fix the behavior, I suggest somehow making your file not be a Form! Cant blame VS for thinking you want to work with a form when you open a form's file!

Karl
+5  A: 

Yes.

In the file's context menu, select "Open With..." and use the "Set as Default" button with your prefered editor selected (in your case, probably the CSharp Editor).

Coincoin
I love you. In a non-gay way... =)
Awesome, that has always annoyed me...
Pat
I love that feature, it protects me from the useless XML schema designer, the DataSet designer, and other annoyances. :-)
Christian Hayter