|
-
Feb 19th, 2002, 01:41 PM
#1
Name spaces!!!
Well, I just need a little suggestion. Lets say I'm creating a name space "tools". I want to have sections in tools, like "tools.file.{other functions here}" . I was just wondering what's a good way to add categories to my name space? should I make them all classes, modules, or what?
something like this:
Namespace Tools
Class File
......some functions here.......
End Class
Class Graphics
........some functions here.......
End Class
End Namespace
-
Feb 19th, 2002, 02:17 PM
#2
the way you state is probably the best usage for a Namespace.
-
Feb 19th, 2002, 05:06 PM
#3
tnx alot, I just didnt know the correct way
-
Feb 20th, 2002, 05:03 AM
#4
Hyperactive Member
I'm just trying these namespaces, just one question, how do you call them in the main program?
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Feb 20th, 2002, 09:26 AM
#5
Imports namespacename.classname
-
Feb 20th, 2002, 12:47 PM
#6
I dunno if this is a good thing to do, but I ended up declaring the functions in my namespace's class as SHARED, so I would be able to use them without declaring an object from that class.
like this:
VB Code:
Namespace Tools
Class File
Shared Function ......
Shared Function ......
Shared Function ......
End Class
Class Path
Shared Function ......
Shared Function ......
Shared Function ......
End Class
End Namespace
Is it a bad idea to declared all the functions as shared?
-
Feb 20th, 2002, 12:57 PM
#7
Well I really depends. the Shared attribute is mostly used for sharing data for the procedure or varaiable across other instances of the class. So if thats what you need it for then i guess there is no problem. Otherwise if you just want all the classes to share a procedure in a single instance, it would probably be best to put them in a public module
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
|