|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to invoke the ClassLibrary?I writed some classes(but not a class) in a ClassLibrary and builded a test.dll file, but how to invoke the test.dll? 'test.dll////////////////////// Moudle MyTest Public class A ... End Class Public class B ... End Class Public class C ... End Class End Module I have referenced the test.dll in my new project, but do not know how to use Class A, B, C. Thank you
Show quote
Hide quote
"yxq" <ga***@163.net> schrieb: Remove the 'Module' declaration around the classes and simply use the > I writed some classes(but not a class) in a ClassLibrary and builded a > test.dll file, but how to invoke the test.dll? > > 'test.dll////////////////////// > > Moudle MyTest > Public class A > ... > End Class > > Public class B > ... > End Class > > Public class C > ... > End Class > End Module > > I have referenced the test.dll in my new project, but do not know how to > use Class A, B, C. classes as you would do with classes which are part of other libraries: \\\ Imports ClassLibrary1 ' Importing the DLL's namespace. .... Dim c As New C() .... /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> If you've referenced the dll for the class library, then just add the Imports
statement to the module or class in which you want to use the library classes. Then: dim myClass as New Class A, etc. However, unless your classes in the Class Library are really tested and won't need and changes, the easiest way is to add the Class Library project to your solution in which you will use the Class Library. That way, you can easily change any of the classes in the class library and/or add to it quickly within your solution. -- Show quoteHide quoteDennis in Houston "yxq" wrote: > Hello, > I writed some classes(but not a class) in a ClassLibrary and builded a > test.dll file, but how to invoke the test.dll? > > 'test.dll////////////////////// > > Moudle MyTest > Public class A > ... > End Class > > Public class B > ... > End Class > > Public class C > ... > End Class > End Module > > I have referenced the test.dll in my new project, but do not know how to use > Class A, B, C. > > Thank you > > > Add the dll to the project references. You may also need to add the class's
namespace to the 'imports' in your project. Reference methods from your classes by instantiating them first: Dim aclass As A = New A then call methods/properties from the instance: aclass.myProperty = "something" aclass.myMethod() You should be able to bring it together fairly easily - if you can't then see here: http://msdn.microsoft.com/vstudio/express/vb/learning/ Troy Show quoteHide quote "yxq" <ga***@163.net> wrote in message news:epx%23MiDWGHA.1228@TK2MSFTNGP02.phx.gbl... > Hello, > I writed some classes(but not a class) in a ClassLibrary and builded a > test.dll file, but how to invoke the test.dll? > > 'test.dll////////////////////// > > Moudle MyTest > Public class A > ... > End Class > > Public class B > ... > End Class > > Public class C > ... > End Class > End Module > > I have referenced the test.dll in my new project, but do not know how to > use Class A, B, C. > > Thank you > >
Create controls at runtime
RE: Which software do I need to program VisualBasic ? AppDomainSetup: ShadowCopyFiles, ShadowCopyDirectories Interpret HTML <Script> in Visual Basic How to detect when ShowDialog object has closed? (2003) Re: String.Trim really strange error MDI Child Controls question Unzipping in Visual Basic .Net Host application in IE |
|||||||||||||||||||||||