4

I am building a win-forms app in c#. A few days ago I opened my project and the design view was closed. I've tried right clicking the form and pressing "open with...", but no option appears to open it in design view. All other questions related to this are for ASP pages and the answers don't work (eg. Blend in Visual Studio 2015 - No Design View). The following is a screenshot of my IDE: Screenshot of Visual studio 2015

Emile Akbarzadeh
  • 326
  • 2
  • 14

2 Answers2

8

Thanks to Mohit's comment I found the root of the problem to be that a class was at the top of the Form1.cs file. It shouldn't have been the first class in the file. I moved the class below the main class and the design view opened again.

Emile Akbarzadeh
  • 326
  • 2
  • 14
4

You can press Shift + F7 (or only F7 depending on the project type) instead to open it.

From the design view, you can switch back to the Code Behind by pressing F7.

Edit

Look at designer.cs carefully and try to find any event which you have created which is present in designer.cs and not in the code behind. If so just delete that line from desginer.cs which declare event.

Mohit S
  • 13,723
  • 6
  • 34
  • 69
  • I've already tried those combinations while being active on various components, but still nothing happens. – Emile Akbarzadeh Dec 22 '15 at 06:38
  • Look at `designer.cs` carefully and try to find any event which you have created which is present in `designer.cs` and not in the code behind. If so just delete that line from `desginer.cs` which declare event. – Mohit S Dec 22 '15 at 06:41
  • 1
    If this or any answer has solved your question please consider [accepting it](http://meta.stackexchange.com/q/5234/179419) by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. – Mohit S Dec 22 '15 at 06:56