|
-
Oct 9th, 2009, 02:14 PM
#1
Thread Starter
Hyperactive Member
Help with Modules
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.
-
Oct 9th, 2009, 02:19 PM
#2
Re: Help with Modules
"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.
From my burrow, 2 feet under.
-
Oct 9th, 2009, 02:46 PM
#3
Thread Starter
Hyperactive Member
Re: Help with Modules
But then how do i do so the Sub class appears under the Sample Module?
-
Oct 9th, 2009, 03:02 PM
#4
Re: Help with Modules
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.
From my burrow, 2 feet under.
-
Oct 9th, 2009, 03:16 PM
#5
Re: Help with Modules
 Originally Posted by Cyb3rH4Xter
But then how do i do so the Sub class appears under the Sample Module?
Like Campion says - it sounds to me you are wanting to create a namespace. I'm in C# mindset at the moment but if you google it I'm sure you'll find an answer for vb.net.
-
Oct 9th, 2009, 05:30 PM
#6
Re: Help with Modules
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.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|