views:

46

answers:

2

I have a situation where I have several VB.NET Modules in the same Logical-Module of a large application.

I would like the update function of each module to be public, but I would like users to be forced to qualify the function call with the module name.

ModuleName.Update()

instead of

Update()

Is this possible?

Thanks.

+2  A: 

No.

The VB.NET specifications automatically use Type Promotion to allow this behavior to occur. The only way to avoid this is to have a type at the namespace that has the same name (Update) which would prevent (defeat) the type promotion provided in VB.NET.

Reed Copsey
Reed, you know a lot of stuff. I'm glad, because I like learning. Thanks for your answers today.
hamlin11
+1  A: 

Using modules is usually a poor design. Consider replacing them with Classes. A module in VB.NET is simply a static class. In other words it doesn't have to be instanced and you can call module.function. When you replace your modules with classes you will need to instance them. Then you can call class_instance.update with ease.