user180574
user180574

Reputation: 6084

VB visual studio 2015 IDE: missing designer view of forms

When using the IDE, I notice that I can no longer open the designer view of certain forms. As seen in the screen shot attached, there is no "View Designer" in the pop-up menu. I didn't touch those files during this round of programming, so it should be the system that did the favor (or by my accident). I search online and although it is not a new question the solutions that I have found don't quite seem to work or maybe not intuitive enough for me to understand.

For example, one suggests to run "devenv" with either a skip or reset option. But I cannot find this program in my system (Windows 10 + Studio 2015). Other suggests to create new form and copy then delete old form, which I am not convinced and due to its manual complexity I would prefer something more simple if possible (what if it keeps happening in the future?).

Thank you very much for the help.

enter image description here

Follow the suggestion by Visual Vincent (i.e., delete all form files, re-add them, and add two lines in the form file), not quite work. Here is the screen shot.

Note "Form3", after re-adding, the file hierarchy becomes different.

enter image description here

Upvotes: 0

Views: 5055

Answers (2)

AS7K
AS7K

Reputation: 457

I'm using C# but had the same problem. For me it turns out that I had declared other classes before my form class declaration ("public partial class MyForm: Form"). As soon as I moved those class declarations to the end of the file I could view the form designer again. Note:It is considered good practice to have such declarations in their own file.

Source: Fix removal of Windows Forms Form in project file by error, or intention, causing form Solution Explorer icon to change

Upvotes: 1

TnTinMn
TnTinMn

Reputation: 11801

As has been stated by Hans Passant, it is likely that your ProjectName.vbproj file has become damaged in some manner. Most likely the <DependentUpon> tag was deleted from the entries of the constituent files of your Form3.

You can try to edit the project file yourself or you can try the following procedure.

  1. In the Solution Explorer, select Form3.vb, Form3.designer.vb, and Form3.resx.
  2. Right-Click on the selected file and click on "Exclude from Project".
  3. Save the Project.
  4. Close the Project.
  5. Re-Open the Project. At this point you should see Form3 with a normal tree structure except that it will be grayed out to indicate that it is not part of the project.
  6. Right-Click on Form3 and select "Include in project".
  7. Save the project. All should be good at this point.

Edit: In response to the comment about the Exclude From/Include In Project Solution Explorer options not existing in VS2015, I am adding this image. Note that you can also select those items via the Project Menu dropdown. enter image description here

Upvotes: 2

Related Questions