Import a form

  • Thread starter Thread starter toney
  • Start date Start date
T

toney

Hello. I want to use a form (an AboutBox) that I created in another project.
How do I import it?

Thanks
 
Hello. I want to use a form (an AboutBox) that I created in another project.
How do I import it?

Thanks

Why not just put it in it's own library, and then reference it form multiple
projects.
 
Hello. I want to use a form (an AboutBox) that I created in another
project.
How do I import it?

Tom's suggestion is good, but you can also copy the files from one project
to another. Be sure to get all the extensions. For example, if your form is
named AboutBox.cs, copy AboutBox.* to your new folder, because there will
probably be AboutBox.Designer.cs and AboutBox.resx. Then do a search and
replace in those files to change the old namespace to the new namespace.
 
Tom's suggestion is good, but you can also copy the files from one project
to another. Be sure to get all the extensions. For example, if your form
is named AboutBox.cs, copy AboutBox.* to your new folder, because there
will probably be AboutBox.Designer.cs and AboutBox.resx. Then do a search
and replace in those files to change the old namespace to the new
namespace.

This is correct but here's a small hint: Visual Studio takes care of this
automatically if you select the .cs file via the Project->"Add Existing
Item..." menu item or drag it to the Solution Explorer in a Windows Forms
project. :)
 
This is correct but here's a small hint: Visual Studio takes care of this
automatically if you select the .cs file via the Project->"Add Existing
Item..." menu item or drag it to the Solution Explorer in a Windows Forms
project. :)

That's cool. I never really tested it, and I just assumed that it would
reference the item in-place instead of copying. Nice to know.
 
Thanks, everyone. Using the Add Items worked. It didn't take care of
everything, though. I still had to add a reference that I was missing as a
result, but that's because I'm new to C#.
 
Back
Top