Just got VS 2008 for work, I am converting some items from VS 2006 to VS 2008.. But one project I want to split. So I converted the old project to VS2008. Then created a new shell project. Using the "add existing item" I tried to copy the forms in.. In 2006 you saw the 3 files (form.cs, form.design.cs, form.resx) but only selected the form.cs, and the other two forms followed it in as subcode under the form.cs on the directory tree.

I see 2008 does not even show the *.cs by default. Instead it default to only showing the .resx. So I tried to just choose that, (thinking they were trying to be helpful and show only what I needed to copy in.) I got only the .resx file and it was basically worthless on it's own.

So I deleted it, went back to "Add existing item" and chose to view all. I selected only the *.cs. But only the *.cs was brought in and not the subcode.

So I cleared down again and returned to view all. I selected all the files for each form. But they all come in at the main level rather then the *.cs being top level and the *.resx and *.Designer.cs being the sub level.. and again like that they are worthless.

So what is the trick to copying forms out of one project into another? And before I hit a problem.. Is there something I should know about copying forms within projects to a different name?

Thanks..

Open both projects, and drag and drop the form from one to the other, it should copy all the bits it needs - it did for me.

Hmmm.. you must have a nicer version then mine. When I click & drag, I get the circle with a slash through it and nothing drops in.. I also tried copy & paste.. No go.

I did find the with VB 2008 it is still working nicely.. But not C#.. this is frustrating!!!

Add a form to the new project with the same name as the form you want to copy and add a context menu strip to the form, and save it (the context menu strip forces the .resx file to be created). Next physically copy the files from the old project to the new project, replacing the 3 files. After you have replaced the files you will need to edit the .cs and .designed.cs files and replace the namespace with the current assembly you are working on.

I have found the copy/paste methods problematic and since the form can have the .resx it changes how the files associated are stored within the .sln, thats why i go through the trouble of creating a new form with a context menu before copying.

Hmmm.. you must have a nicer version then mine. When I click & drag, I get the circle with a slash through it and nothing drops in.. I also tried copy & paste.. No go.

I did find the with VB 2008 it is still working nicely.. But not C#.. this is frustrating!!!

VS 2008 express is all Im using.

This article has been dead for over six months. Start a new discussion instead.