Yesterday I edited a form in Visual Studio's form designer. When I returned to it today, the designer shows nothing. I can open the properties window, select all the different constituent components and edit their properties, but they do not show up. The application builds fine and the form can be run as usual.
I've tried a couple of different solutions, such as checking the .csproj file has the form.Designer.cs included, but nothing has worked.
Strangely, I did see this problem earlier in the week, but it fixed itself when I unlocked my computer after returning from a coffee break.
Any suggestions?
I face a similar problem in Visual Studio 2019.
To help others who may have this issue.
The problem is due to the class declaration in the Form1.cs file.
Please ensure public partial class Form1: Form class is the first-class declared in the file. No other class declaration should be on top of this.
As described in this answer: https://stackoverflow.com/a/40243490/8887398
Thanks,
Sankar
I had similar issues in VS2019. I resolved it by using:
Window > Reset Window Layout.
Then double clicked on the Form in the Solution Explorer.
Prior to this, double clicking the form was having no effect.
Weird, after trying for an hour I ended up solving the issue 30 seconds after posting this!
I edited the size property of an item on the form using the properties tab, saved the form, and then reverted the form.cs, form.designer.cs, and form.resx files to the latest source control version.
At this point the form jollily re-appeared.
Edit: FWIW, this didn't work with another form which was exhibiting the same problem.
Edit 2: That other form has now fixed itself after coming back from lunch and unlocking my PC... Might be something to do with how that affects the display - everything shifts over to my right hand monitor when I do that.
Edit 3: OK, now it seems that modifying my display DPI fixes it. On Windows 10 go to System Settings -> Display, and then move the "Change the size of text: 100%" option to say 200%. Once this changes on screen, move it back to 100%.
This seems quite foolproof, although you sometimes have to jimmy it around a lot before it finally works. I know it has worked when I get both a vertical and horizontal scrollbar; the form is then further down the page.
Just go to Form1.cs (Form1 is the name of your form), if you are able to see your source code then press Shift + F7. The form will show up.
I also had a similar issue in VS2019.
My form [Design] was listed in the solution explorer but the code was not listed as a sub-item of that form.
I could access the code by right-clicking on the form in the solution explorer and choosing view code.
What seemed to solve the problem was to close down VS2019 and simply re-open it up.
A Message appeared (with Errors and Warnings) for me which said that the first mentioned class in a cs code file must be the form class. I shifted my form class to the top of the files and everything was fine.
There are actually a few reasons that one might encounter this issue.
At times, it can be due a problem within the VS IDE and the way it incorrectly manages file types and subtypes. It normally does a great job with this "automagically", but it can also make painful and unexpected mistakes.
If you right-mouse-click (RMC) your Project, and unload it (not your solution) you will be able to RMC it again and choose "Edit Project File". Once there, search for your Form name. In my case, I will search for Form1.cs, note the incorrect icon I saw in the Solution Explorer View, and the code describing my form, within the project file:
<...>
<Compile Include="Form1.cs"/>
<...>
Change this declarative statement to the following, adding the "Form" subtype:
<...>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<...>
Save your project file, then RMC on your project name in the Solution Explorer, choose "Reload Project", and you will see the correct icon as expected, and once again be able to use the form in Design mode:
*Note: This issue shouldn't occur with default forms (named Form1, Form2, etc) and even in my case, it happened with a form I named other than the default form name. I used that name in this example, purely for illustrative purposes.
Hopefully, this helps someone.
Wishing you all the best!
I hadn't changed anything that would have broken my form, yet it still wouldn't load when I tried view designer. Restarted VS2019 and it worked after that. Give that a go before you try anything else!
I had the same problem.
My solution was to remove and add again the System.Windows.Forms reference.
Go to Tools > Options > Environment > Preview Features and select the Use the preview Windows Forms designer ...
Then restart
OK, so I have built a Windows Form application. I now want an icon for it. So I use the Icon Editor built into Visual Studio 2012. Draw it all out to look nice and purdy. Once I am done, I have a .ico file and I make it the default icon for the project, and also the icon for the one WinForm in the application.
Unfortunately, it does not show up as I have created it! It is displayed as the default icon file as it existed before I modified it in the icon editor. It's a 32x32 4 bit icon. If I change the extension to .bmp it shows up as the default.
It looks like the VS icon editor is editing something else, not the appearance of the icon. Can someone tell me what I am doing wrong?
I used to have a progam called IconArt that would create icons that looked like icons when I used them in VS. IconArt is now abandonware and won't run on my 64bit Windows workstation.
Since I didn't get any answers within the time I was hoping, I posted this question also in the MSDN Visual Studio forum, and got a good answer that I thought I should post here. Credit to Reed Copsey, Jr, for the answer!
This is it:
You'll need to put your design in all of the different versions. ICO
files contain multiple versions of the same image, for different
screen resolutions.
My personal preference is to not use VS - there's an ICO plugin for
Paint.Net (all free) which allows you to make a single image
(typically 256x256), and save multiple versions within an ICO file in
one shot. It's very useful for building icons.
See
http://forums.getpaint.net/index.php?/topic/927-icon-cursor-and-animated-cursor-format-v37-may-2010/
for the plugin.
Since I am a Paint.Net user, the plugin sounded like a great idea, and I tried it. Bingo! This works very nicely.
I'm very confused about this - as I mentioned in the title everything is okay when I build, but when I'm developing the code the fact that what is appearing in Visual Studio is different to what I get when I build is unsettling. Maybe someone can see what is going on?
Basically, I am unable to define widths for menu items or the header text disappears. It works fine when building though. I've included some screenshots and my code to make this easier to understand.
Thanks
With no width defined, the alignment is strange:
If I define a width, the text disappears!
Yet if I do define a width, while the text doesn't appear in Visual Studio when I run the application it does perfectly!
If anyone has any ideas that would be greatly appreciated.
I had heavily modified the canvas theme via child theme.
There is ugly border around the images in Internet explorer. Take look on the below screenshot and help me to resolve the same.
http://i51.tinypic.com/el1mp4.jpg
Please help me to troubleshoot this CSS issue.
This is either a bug due to the VM being in 16bit colour or IE6's jpeg decompression techniques. Either way I don't think it's your website and I would advise you to just ignore the problem, stop worrying about IE6.
I'm working on an application that will have attachments, and I would like to create a type of display like in windows Explorer, where you choose a "Details" view, and also show the preview pane.
I would like to be able to show a thumbnail view of the attached file currently selected, based on the file extension.
Does anyone know where I can start to look for examples on how to pull this off?
I know Outlook 2007 can also do something similar using preview handlers. I think that’s going to be the direction I want to go in, but I'm not sure where to start.
Many thanks.
All Hail the Glory of the Hypnotoad!
While you could do it in WPF, you should not do it.
Seriously: don't do it! - you would break many apps (including one of mine).
To do this without .NET, see here for a nice guide.
I think you can start here
http://blogs.microsoft.co.il/blogs/eyal/archive/2007/07/29/Hosting-vista_2F00_office-2007-previewers-in-winform-application.aspx
(the code is partially black on black, at least for me, but you can disable the styles or just copy it)