Compiling VB (.NET) files located in different directories

A

AA

Hi,
I am having to vb files. One is located under C:/VB/main and the other
is under C:/VB/class.
File under main looks like:

<code>
Module Module1
Sub Main()

Dim test As New Test1

End Sub

End Module
</code>
The class Test1 is defined in the file (class_test.vb) under class
directory. When I compile the code, I get an error saying Test1 is not
defined. This is because class_test.vb is located in some other
directory.
Any idea how this can be resolved? I want to main the directory
structure.

Regards,
P
 
C

Cor Ligthert [MVP]

AA,

Use your Solution Explorer to create folders and don't use Window Explorer
for that.

Use the same Solution Explorer to move your classes inside that.

If you have done it with Windows Explorer than click in top of Solution
Explorer the icon Show all files.
Than include the folders etc. what you need. Don't include things as the Bin
and Obj folder because than it is in use and can't make builds anymore in
it.

I hope this helps,


Cor
 
A

AA

It worked, great!!!
I have one more question: Like in C, for every file we get an .obj
created. All these object files then get linked to the final dll/exe.
Is there a similar process in VB.NET? What I mean by this is; is there
a way that I can build each folder individually and then combine
everything to get my final exe?

Regards,
AA
 
C

Cor Ligthert [MVP]

AA,

It is better to place for every question a seperate message. Now I am
probably only answering and maybe there are some who can give a better
answer. However,

You can create libararys (DLL) and use those in your programs.
Project->Add References -> browse and than point to the created DLL

You can as well add those libarary projects to your VB project just as you
want and than is the reference.
Project-> Add References -> Projects

I hope this helps,

Cor
 
A

AA

Yes, it did help a lot. I created a class library, built a dll from
that and added that in Project->References. In my main.vb, I am
instantiating object of that class (embedded in the dll) as
Dim class_object As DllName.ClassName

thanks a lot for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top