Namespace Question ...

  • Thread starter Thread starter Joe HM
  • Start date Start date
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
 
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
 
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
 
Back
Top