Wayne
Wayne

Reputation: 23

I've lost the design view of Visual Studio C# 2008

I've been working on a project for a while. Design view (the form) was available to me, but suddenly, I don't have it anymore. The .cs file is there with all the controls, but I have no idea how to regenerate the form view. Can you help please? I am quite new to this.

This has happened to me before. I did find a way to get it back. But I forgot how to do it. Oops.

edit----- like I said, im new to this. I'm getting in a right mess. Here's the code with the compiler

Error 1 The type or namespace name 'Form1' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Wayne\AppData\Local\Temporary Projects\WindowsFormsApplication2\Program.cs 18 33 WL Lending Calculator

Im sure I've renamed something I shouldn't have

`using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms;

namespace WL_Lending_Calculator { static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } } `

im trying to get the code to display correctly here, with the code tag, but not having much luck

Upvotes: 2

Views: 10051

Answers (6)

atoms
atoms

Reputation: 3093

I managed to resolve this in Visual Studio 2017 by modifying the project.csproj file to contain an extra property 'SubType'.

<Compile Include="forms\ParcelEditor.cs">
  <SubType>Form</SubType>
</Compile>
<Compile Include="forms\ParcelEditor.Designer.cs">
  <DependentUpon>ParcelEditor.cs</DependentUpon>
</Compile>

Instead of how it was before:

<Compile Include="forms\ParcelEditor.cs"/>
<Compile Include="forms\ParcelEditor.Designer.cs">
  <DependentUpon>ParcelEditor.cs</DependentUpon>
</Compile>

Upvotes: 1

Nikos Kritikos
Nikos Kritikos

Reputation: 1

In you app.config file at your project folder you must iclude this code

    <Compile Include="MyForm.Designer.vb">
      <DependentUpon>MyForm.vb</DependentUpon>
    </Compile>
    <Compile Include="MyForm.vb">
      <SubType>Form</SubType>
    </Compile>
<EmbeddedResource Include="MyForm.resx">
      <SubType>Designer</SubType>
      <DependentUpon>MyForm.vb</DependentUpon>
    </EmbeddedResource>

Upvotes: 0

Ela
Ela

Reputation: 11

This works for 2010 visual studio C#. I hope it works for you too.

Open the .cs file

Right click anywhere in the code area and click on "View Designer"

Upvotes: 1

Michel
Michel

Reputation: 282

As erwin said, the exception is the root of your trouble.

The designer NEEDS access to a compiled version of the design mode of all the component inside the aspx. There are many possibilities, depending on where is WLLendingCalc :

  1. WLLendingCalc is in an uncompiled library : try rebuild all (or at least rebuild the library)
  2. WLLendingCalc is an ascx with bad html / XML : correct it
  3. your library for WLLendingCalc compiles, but has a faulty design mode
  4. your ascx registration for WLLendingCalc is wrong in the aspx or your library registration is wrong : check Register TagPrefix ; Register Assembly
  5. your registration for WLLendingCalc is in web.config and there is a syntax error in it

Upvotes: 2

mpontillo
mpontillo

Reputation: 13947

If you right-click the file and select Open With..., do you see an option for CSharp Form Editor? (In the Open With... dialog you can also set the form editor back to being the default for the applicable type.)

Upvotes: 0

Erwin Alva
Erwin Alva

Reputation: 393

Is the designer showing an exception? Usually the exception shows what's wrong. If not, usually a rebuild of the entire solution fixes it. This only works if the controls are all built from the same solution.

Upvotes: 2

Related Questions