18Dec SalesLogix 6.2 Consuming .NET DLL
If you have ever wanted to include some C# or VB.NET code in your SalesLogix app but couldnt figure out how to get the component created here are the steps:
First create your .NET DLL . I utilized an example that told me I needed to also include a default constructor with no params:
using System;
namespace JasonNetC{ ///
/// Summary description for Class1. ///
public class Huber { public Huber() { // // TODO: Add constructor logic here // } public void Init () {
}
public string writemessage() { return "You made it into C#!"; }
}}
Compile it and remember the location.
Next I needed to utilize REGASM and get a typelib as well as the necessary registry entries…
For this I typed the following in the command prompt:
"C:\WINNT\Microsoft.NET\Framework\v1.1.4322\regasm" "C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\JasonNetC\bin\Debug\JasonNetC.dll" /tlb:JasonNetC.tlb
Once this is complete I moved the dll next to the comsuming application. In this case:
C:\Program Files\SalesLogix
Now I can simply create a form and include the following to create my object:
Sub btnCheckClickNet(Sender) dim jh2 set jh2 = createobject("JasonNetC.Huber") msgbox(jh2.writemessage())End Sub
If you dont want or cannot place the dll next to the exe that is consuming it, then you need to gacutil /i the dll and this requires a strong name file. Another time.
References:
http://www.codeproject.com/dotnet/cominterop.asp?df=100&forumid=1990&exp=0&select=1672764#PART2
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=106

