|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to properly "name" a class library?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 *** Terry Olsen wrote:
> I have written a class library that I want to reference from a windows You need to make sure the root namespace in the settings for your> 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()? > 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
Location for shared Access database
Make copy of arraylist Clipboard Question Getting the current procedure name? newbie: is this the appropriate use of a class? TItem, TData, etc? Generics VB.Net XML Comments and Intellisense for COM? Printign data over form AUTOMATIC FONTS Newbie: Textbox text from string |
|||||||||||||||||||||||