cannot open form in design view

Hi i saved a visual basic 2005 project containing two forms. When reloading the project the next day, i could not get the design view of those forms anymore. I only see the code in form1.designer.vb, i do not see the form with the usercontrols itself. In the solution explorer i see a node form1.vb with an icon which looks like a small textfile and "VB" in its corner. When i click on this node two files appear: Form1.designer.vb and Form1.resx. I also noticed that in a project where i do see the form in design view, the icon of the node form1.vb looks different from the icon in this project. What has gone wrong here or do i need to know something

i hope i gave a clear enough description of the problem so that you can help me!

regards!

Tamar



Answer this question

cannot open form in design view

  • rgerbig

    Have you tried right clicking on the file and choosing "View Designer"

  • Peter Huang --- MSFT

    hi, tamar

    in the top of solution explorer you will find an icon to hide files click it , this will remove the "+" sign beside the form,

    your class will be consists of 2 parts "form.designer.vb ", "your code". the "design view " use the "form.designer.vb " to generate the UI,

    just double click on the form icon that looks like paper it will open the designer view, the form.designer.vb is a class where the designer generate the code there , don't play on it unless you know what you are doing or it will corrupt the designer

    hope this helps



  • Helloimbob

    Hi Tamar,
    To solve the problem:
    1-Open the project in VB2005
    2-Select the form (just 1 Click)
    3-In the Properties Window
    , you will see "Build Action", toggle between the values which are: Compile, None, Content, Embedded Resource. in fact it should be compile.

    after this you will see the design form back again :)

    good luck
    mario



  • scott13

    This has happened to me. The Solution Explorer doesn't give a View Design option for the broken form, and opening the form only displays its code. Under the bonnet, each form has three files (.vb, .Designer.vb and .resx). For the broken form the .vb file is completely empty (0 bytes) whereas for other forms it contains the form's class definition. Either VS hit a problem saving this file, or I corrupted it. I've seen this a couple of times, and the part of my brain that teaches me things like not sticking my fingers in the fire is of the opinion that it's to do with renaming form files (as distinct from just renaming the forms themselves) in the Solution Explorer. I don't have any hard evidence to support that, though.

    To fix the problem I opened the .vb file in Notepad and inserted the following:

    Imports System.Windows.Forms
    Public Class <formName>
    End Class

    Opening the project afresh in VS, the 'View Designer' option has reappeared for the broken form and everything appears to work. Of course, while this might get things flying for a simple form, it won't be so straighforward if the .vb file should have contained shedloads of code. Still, maybe this semi-fix will save someone a late night recreating their beloved form.



  • sulphox

    Hi, thanks for your response,

    I did try to right click on the file to see what are the options in that menu, however unfortunately i only see an option to "View Code" or "View Class Diagram". You are right that it should be there; at least it is with my "working projects". Yet it's dissapearance is the central issue here.

    greetz,

    Tamar


  • cannot open form in design view