Solved

Visual Studio 2005 - Add existing item - Form

Posted on 2010-11-11
6
767 Views
Last Modified: 2012-05-10
Hi,
  When I try to use a form from an old project in my new project, I can usually Right click on the project, then hit "Add" | "Existing Item" then point to my windows form in my old project and all is good.

However if the form  has an embedded image for a background image, when I try and open up that form in my new project, all I get is

some HTML stuff saying something about
...
this.BackgroundImage = global::myProject.Properties.Resources.splash4;
The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified.  Please remove any changes and try opening the designer again.

how do I fix this?

Thanks

0
Comment
Question by:carl-
  • 5
6 Comments
 
LVL 7

Expert Comment

by:rogerard
ID: 34115287
When you're adding the old form, make sure you also add it's associated files, like it's .resx and/or .designer.vb
0
 
LVL 4

Author Comment

by:carl-
ID: 34116020
the associated forms designer.cs and form.resx get added automatically.  Problem is the background image is under the global resource:  Properties Resources.resx Resources.Designer.cs and the namespace was different, so it cant find it and thus cant open.  I cant figure out how to change the namespace of that resource in the form that wont open because well, it wont open :-)
0
 
LVL 4

Accepted Solution

by:
carl- earned 0 total points
ID: 34116190
figured it out. I went into the form.designer.cs file and edited the background image in the part that says "Windows Form Designer generated code.
 this.BackgroundImage = global::<exe_name>.Properties.Resources.splash4;

turned out to be exe_Name, not namespace name.

all is well now.
0
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 
LVL 4

Author Comment

by:carl-
ID: 34116213
sorry, make that default Namespace name. (That is supplied by right clicking on the project and reading the application tab's default namespace.
0
 
LVL 4

Author Comment

by:carl-
ID: 34116404
if there was an "Award Points" for answering without "Accepting as solution" I'd gladly do that, but it wasn't the solution so I cant.
0
 
LVL 4

Author Closing Comment

by:carl-
ID: 34143513
just closing out question that I figured out.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question