Solved

Visual Studio 2005 - Add existing item - Form

Posted on 2010-11-11
6
766 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
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.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

777 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