I created a module named Sample, in it i made a Public Sub called Sub. But how do i do to add something "behind sub", so i can write like this:
Sample.Sub.alternative1
Sample.Sub.alternative2
etc.
Printable View
I created a module named Sample, in it i made a Public Sub called Sub. But how do i do to add something "behind sub", so i can write like this:
Sample.Sub.alternative1
Sample.Sub.alternative2
etc.
"Sub" would have to be a class all its own. However, I would say that you NOT use the name "Sub", as that is a reserved keyword, and VB will complain.
But then how do i do so the Sub class appears under the Sample Module?
If it's in a module, you don't have to do anything. You can call your class directly from any code in the program, as modules are static classes in and of themselves. I suggest you look into using Namespaces instead, though, as Modules are meant to hold routines, not other classes.
Perhaps a bit more explanation would make sense. After all, I note that you used Sub.alternative1, Sub.alternative2 as your example. You certainly could make it so that you would have to type all that out, but I can think of no good reason to do that. If by Sub, you actually do mean a subroutine, then, depending on what you actually want to use it for, there may be a way to get there without as much typing.