Link to home
Start Free TrialLog in
Avatar of sasllc
sasllcFlag 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
User generated image
ASKER CERTIFIED SOLUTION
Avatar of Ioannis Paraskevopoulos
Ioannis Paraskevopoulos
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial