Avatar of sasllc
sasllc
Flag for United States of America asked on

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
Visual Basic.NET

Avatar of undefined
Last Comment
Ioannis Paraskevopoulos

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Ioannis Paraskevopoulos

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61