can I use Imports with a VB2005 class namespace?

G

Guest

Hello,

I have a project (vb2005) and I added a class (a vb file) that resides in a
separate directory from the main project. Rather than instantiating objects
from this class to use its properties and methods, is it possible to use the
Imports keyword like in C# to import that class namespace?

How can this be done? or how can something equivalnet be done?

Thanks,
Rich
 
H

Herfried K. Wagner [MVP]

Rich said:
I have a project (vb2005) and I added a class (a vb file) that resides in
a
separate directory from the main project. Rather than instantiating
objects
from this class to use its properties and methods, is it possible to use
the
Imports keyword like in C# to import that class namespace?

You can assign a namespace to the file using the 'Namespace' block. Then
you can import the namespace and instantiate/use the class. In addition you
can even import the class in order to be able to access its shared members
without qualification by the class name.
 
G

Guest

I think I figured this out. I gieve the added class a namespace name
(without including the project name as part of the namespace unlike C#).
Then when I type Imports in the main class I will see the project name in the
initial listing, I select the project name, then I see the class(es) I add to
the project.
 
C

Cor Ligthert [MVP]

Rich,

Did you look at the answer from Herfried, seems for me quiet the same.
The times of sending are equal, but I get the idea because that there is no
reply on Herfried answer that you did not even look at that. Knowing that
set you on a lower answering priority.

Cor
 

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