By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,330 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

How to properly "name" a class library?

P: n/a
I have written a class library that I want to reference from a windows
app. The filename is UPSTrackTool.dll. The Class name is UPSTrackTool.

When I reference it from my windows app, I put the Imports UPSTrackTool
at the top. But when I call any methods I have to use:

UPSTrackTool.UPSTrackTool.MyMethod()

How do I name this thing so I only have to Imports UPSTrackTool and then
I can just call MyMethod()?


*** Sent via Developersdex http://www.developersdex.com ***
Nov 10 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Terry Olsen wrote:
I have written a class library that I want to reference from a windows
app. The filename is UPSTrackTool.dll. The Class name is UPSTrackTool.

When I reference it from my windows app, I put the Imports UPSTrackTool
at the top. But when I call any methods I have to use:

UPSTrackTool.UPSTrackTool.MyMethod()

How do I name this thing so I only have to Imports UPSTrackTool and then
I can just call MyMethod()?
You need to make sure the root namespace in the settings for your
project is set appropriately. You would then refer to your classes by
this root namespace plus the class name. The root namespace is
typically set to the company name or something like that. It is also
typical to include other namespaces in the code to group classes
together.

For example, suppose the root namespace for the project was set to
MyCompany

Then in your code, you might have the following:

Namespace "DataClasses"
Public Class SomeClass
'Code here
End Class
End Namespace

The program that uses the class library would use an Imports statement
like this:

Imports MyCompany.DataClasses

And then you could use the class as you propose.

Chris

Nov 10 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.