WinBatch® Technical Support Forum

Archived Boards => COM Automation and dotNet => Topic started by: stanl on November 18, 2013, 06:12:13 AM

Title: CLR Assembly Create/Test Sample
Post by: stanl on November 18, 2013, 06:12:13 AM
Put together a zip file with VB code, ini file  and script which should create EURO.dll then return a pounds to Euro conversion based on calling a function from the dll.
Original code to create the assembly from Deana, calling code from Tony [credited in header]. This is a sample based on two previous threads.
Title: Re: CLR Assembly Create/Test Sample
Post by: Deana on November 18, 2013, 07:58:20 AM
Stan,
Thanks for sharing.
Title: Re: CLR Assembly Create/Test Sample
Post by: td on November 18, 2013, 09:19:49 AM
Removing the parameter type specification from a function parameter isn't the best programming style but it obvoiusly does keep you from having to specifiy a type in WinBatch.  Since we are creating an assembly in the context of WinBatch, it makes some sense to take that approach. 

Which you chose depend on your priorities.
Title: Re: CLR Assembly Create/Test Sample
Post by: td on November 18, 2013, 11:00:28 AM
It would probably be better to not mention this but in the interest of complete accuracy...  You don't need to use the 'namespace' keyword in you vb.net assembly  and WinBatch may still be able to access your class by using oTest = ObjectClrNew("Euro")

However, eliminating the namespace keyword to avoid having to type a few letters is a very bad idea. It makes dependent scripts very brittle because of the potential for type name collisions.   
Title: Re: CLR Assembly Create/Test Sample
Post by: stanl on November 18, 2013, 12:05:28 PM
Quote from: td on November 18, 2013, 09:19:49 AM
Which you chose depend on your priorities.

Git er done.
Title: Re: CLR Assembly Create/Test Sample
Post by: td on November 18, 2013, 12:55:24 PM
Quote from: stanl on November 18, 2013, 12:05:28 PM
Git er done.

Understood and thanx.
Title: Re: CLR Assembly Create/Test Sample
Post by: stanl on November 18, 2013, 01:23:03 PM
Quote from: Deana on November 18, 2013, 07:58:20 AM
Stan,
Thanks for sharing.
Using an .ini was to expedite; would have looked better with a dialog. Surprised how little WB code it actually took and it appears re-usable.  Now that my feet are wet I can set about trying to incorporate some VB net for SQL Server.