[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • Last Modified:

Getting "Name conflicts with existing module, project, or object library " when doing Add File to a project

I do not see how it would conflict ...

0
AlexF777
Asked:
AlexF777
4 Solutions
 
Carl TawnSystems and Integration DeveloperCommented:
Are you adding a new file or an existing file ?
0
 
List244Commented:
Well, this happens when two names conflict, obviously.
It is hard to tell you how to fix this without seeing your
project. But, one suggestion try a different name.

Forms have two names.

Saved file name, and form name. Chances are you have
two saved names that are different. Say one is saved as
Calculator.Frm and one is saved as Game.Frm. But both
have an internal name of Form1. You can not do this, you
then would have two Form1's and confuse the compiler.

Simple solution:

Open both forms individually, go to the Name property,
and change one to say: Form1, and one to Form2.
Then, you can reopen your project and add them both.
Good luck.
0
 
EDDYKTCommented:
If your reference (class) contains a same name as your form or class or module, then you will get this error
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
AlexF777Author Commented:
it is a .bas file.

What I have noticed is if my .bas file is a part of some other project - VB complains,
otherwise - it does not ...
0
 
List244Commented:
This is what I was telling you. It is not a matter of which project it is apart of.
It is the fact that you have Module1 added in a project. You save this as say
Winsock.Bas. Then you have another project, say you save a Bas as Skin.Bas.
But then you think oh! That would be great if this program could connect to
the internet. Then, you add Winsock.Bas. The program (VB) now errors, it
can not add Winsock.Bas. Winsock.Bas has a name Module1. The problem
is you already have Module1(Skin.Bas) Two module1's just can not happen.

Like I said, what you need to do is open the one you wish to add. Change
it's name in the property window to something along the lines of what
the module does, rather than Module1. It is good practice to always change
your Module names. This way you can easily add Modules to any project
at any time. Because what are the chances that you have two Winsock.Bas
modules? The chances are unlikely because, why would you write two
things that do the same function? So change your names of the Module
itself, and not the .Bas file. This should allow you to add your modules
with ease. Good luck.
0
 
EDDYKTCommented:
>>What I have noticed is if my .bas file is a part of some other project

I don't think that is the problem, you may want to change this line

Attribute VB_Name = "Module1"

to


Attribute VB_Name = "somethingelse"

Open your .bas from notepad, this is the first line appears on the .bas
0
 
List244Commented:
EDDYKT that is exactly what I have said twice now.
Attribute VB_Name = "NAME" Is the name listed
under Name in properties window. Once again, you
need to change this , because two of your items have
the same name, with different FILE names. And when
you have two internal names the same like that it
will give you errors, because it can not handle it.
0
 
Erick37Commented:
Also make sure that the *name* of the module does not conflict with any libraries you have added in Project->References.  e.g. If you add a reference to win32.tlb, you cannot have a module with a name of "win32."
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now