Restoring Windows Forms Files

Will Gilbert

Member
Joined
Dec 1, 2020
Messages
6
Programming Experience
5-10
I had to restore files from 1 form recently
So I restored 3 files (myForm.cs myForm.Designer.cs myForm.resx) into the location
After restore, and compile, happy days....form ran as expected
But....in the designer, I cannot see any of the controls...they are there fine, but just not visible in the designer
What am I doing wrong
Tia
 
It's hard to say what the specific issue might be but here's a process that I've followed in the past that has fixed similar issues:
  1. Add a new project to the same solution.
  2. In the Solution Explorer, drag the form from the original project to the new to create a copy.
  3. Check that the form works correctly in the new project. Make any additional changes to the project to make that happen.
  4. Delete the form from the original project.
  5. Drag the form from the new project to the original.
  6. Check that the form works correctly in the original project.
  7. Delete the new project.
 
It's hard to say what the specific issue might be but here's a process that I've followed in the past that has fixed similar issues:
  1. Add a new project to the same solution.
  2. In the Solution Explorer, drag the form from the original project to the new to create a copy.
  3. Check that the form works correctly in the new project. Make any additional changes to the project to make that happen.
  4. Delete the form from the original project.
  5. Drag the form from the new project to the original.
  6. Check that the form works correctly in the original project.
  7. Delete the new project.
Many thanks for reply
I'll check it out ..cant right now
Any idea why the original restore does not work ?
These are the only 3 files I need to restore ...right ? anf there are no other dependencies so I don t understand why restoring does not work ??
 
No not just three files. There is also some magic in the .csproj file that may need to happen depending on what kind of operations you may have done dragging in some other assemblies for controls.

This is why using source control is much better. You will have snapshots of your working project that you can go back to, and more importantly, you can see what changes were made in between, so that you have half a chance of cherry picking changes from previous versions if you need to.
 
In theory, yes, but it depends on what you mean by "restore". Generally speaking, you should use the Add Existing Item functionality, which will do all the right things with all the right files.
 
Back
Top Bottom