Namespace Question ...


J

Joe HM

Hello -

I have a set of utilities that are structured as follows ...

Namespace Utility
Public Module Main
Public TestA as cTestBase
Public TestB as cDummyBase
End Module
End Namespace

A VB file that uses them calls
Imports Utility
and then
TestA.functionIncTestBase()
TestB.functionIncDummyBase()
to call a function within.

What I was wondering is if there is any way to create some sort of
namespace like
Namespace Utility.TestA
Namespace Utility.TestB
so that I do not need to specify the "TestA." all the time.

I know that I would use "With Test" but I have about ten instances of
classes for which I would like to do that and I don't think I can nest
With statements?

Thanks!
Joe
 
Ad

Advertisements

A

Aboulfazl Hadi

Hi Joe
Namespaces are a logical grouping of classes. If you want to call a
method of the class, you must create an instance of the class and call
the method by the instance name (not Shared Member ). So it's
impossible to igone instance name and calling only Class Members.

Thanks,
A.Hadi
 
A

Armin Zingler

Joe HM said:
Hello -

I have a set of utilities that are structured as follows ...

Namespace Utility
Public Module Main
Public TestA as cTestBase
Public TestB as cDummyBase
End Module
End Namespace

A VB file that uses them calls
Imports Utility
and then
TestA.functionIncTestBase()
TestB.functionIncDummyBase()
to call a function within.

What I was wondering is if there is any way to create some sort of
namespace like
Namespace Utility.TestA
Namespace Utility.TestB
so that I do not need to specify the "TestA." all the time.

I know that I would use "With Test" but I have about ten instances
of classes for which I would like to do that and I don't think I can
nest With statements?


If the members are shared, you can import them like namespaces.


Armin
 
Ad

Advertisements


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