.NET is my love and Navision is my main activity now. But can .NET and Navision be integrated together? The answer is obviously YES!!
Navision sometimes lacks on some features (for example on graphic features) and if you need a feature that Navision doesn't have, a possible solution could be the integration with a .NET control.
Is this task so difficult? No... integration with Navision is really simple. If you have a .NET control (for example MyControl.dll) and you want to integrate it in Navision, just follow this steps:
- First, you have to register your control (dll) into the system. To do so on the target machine, just open the Comand Prompt and type regsvr32 MyControl.dll. The control will be registered.
- Open Navision, create a new form and into the C/AL Global variable section declare a variable (for example called MyCntr) with DataType = Automation and Subtype = the name of your MyControl.dll (if you click the Subtype field of the variable declaration, a list of available control on your system will be opened and you can choose your control).
- Place a Subform control into your main form (it will be the form for hosting the .NET control).
- In the OnActivate() trigger of the Subform, you have to instantiate the control: to do so, place the following code:
IF ISCLEAR(MyCntr) THEN
CREATE(MyCntr); - Now you can use your control. For example, if your control has a method called Calculate() you can call the method by using the notation MyCntr.Calculate().
- At the end of your application, it's better to free the resources, so into the OnCloseForm() trigger of your main form it's recommended to insert this code:
MyCntr.FreeResources; //It's better to have a method to free resources inside the .NET Control
CLEARALL(); //Free all your resources
As you can see, .NET integration with Navision is not an hard task as could appear... 