Reputation: 23
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
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
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
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
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 :
Upvotes: 2
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
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