viewpoint-particle

Author Topic: CLR Assembly Create/Test Sample  (Read 3511 times)

stanl

  • Pundit
  • *****
  • Posts: 939
CLR Assembly Create/Test Sample
« 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.

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: CLR Assembly Create/Test Sample
« Reply #1 on: November 18, 2013, 07:58:20 am »
Stan,
Thanks for sharing.
Deana F.
Technical Support
Wilson WindowWare Inc.

td

  • Tech Support
  • *****
  • Posts: 3020
    • WinBatch
Re: CLR Assembly Create/Test Sample
« Reply #2 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.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

  • Tech Support
  • *****
  • Posts: 3020
    • WinBatch
Re: CLR Assembly Create/Test Sample
« Reply #3 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.   
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stanl

  • Pundit
  • *****
  • Posts: 939
Re: CLR Assembly Create/Test Sample
« Reply #4 on: November 18, 2013, 12:05:28 pm »
Which you chose depend on your priorities.

Git er done.

td

  • Tech Support
  • *****
  • Posts: 3020
    • WinBatch
Re: CLR Assembly Create/Test Sample
« Reply #5 on: November 18, 2013, 12:55:24 pm »
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stanl

  • Pundit
  • *****
  • Posts: 939
Re: CLR Assembly Create/Test Sample
« Reply #6 on: November 18, 2013, 01:23:03 pm »
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.