Problem adding existing item to Visual Studio 2008 project

Many times over the years I have successfully added existing code by right clicking on the project name at the top, then Add > Existing Item > and browse to another project and pull in a .vb item.  But today it is acting strange and I don't know why.

I am trying to use some code from a project named VB_PowerSample1, so I used the procedure above to add the code to my project.  It looks right on the screen in my project, but the properties show a path that includes \VB_PowerSample1\ -- as though it is not really "in" my project.  The item I brought over is named PowerManagement.vb, and my project is named ecotScan.  When I try to reference this code in a WithEvents statement I have to do it as follows: "Private WithEvents MyPowerMgr As ecotScan.VB_PowerSample1.PowerManagement", i.e. am having to refer to "VB_PowerSample1" which was the name of the original project I imported from.

Since this did not seem right, I deleted the "PowerManagement" item, then I copied PowerManagement.vb" from the VB_PowerSample1 project to my ecotScan project folder and renamed it to C0xPowerManagement.vb.  Next I reopened my project and saw C0xPowerManagement.vb on the right side, but it did not have the correct icon until I chose to "Include in Project" (which I have also never had to do in the past).  But after all that, I still have to use that same syntax that refers to "VB_PowerSample1" even though my project is named ecotScan, and I still have to refer to "PowerManagement" even though the current name is now C0xPowerManagement.  All of this is showing in the attached screen shot in the lower left area and upper right area.

Any ideas what I am doing wrong here--and how to make it act right?  TIA
This is the screen shot referred to in my question
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ioannis ParaskevopoulosCommented:

I am not really sure, but this may get you on the right track. What you see in the dev window as ecotScan.VB_PowerSample1.PowerManagement is not referring to the file name but on the namespace and class name declared in that file. You could name the file whatever you want and still refer to it in the same way.

So, just open that file and check what Namespace is declared. I bet it will be 'VB_PowerSample1'.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.