Navision and .NET

.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...

Print | posted on Thursday, May 19, 2005 10:05 PM

Comments on this post

# re: Navision and .NET

Requesting Gravatar...
Dear sir ,
This article is very nice. if u have plz send some more documents and articles in this(.Net and navision integration)
my email is id saytokittu@yahoo.com
Left by krishna on Jun 13, 2005 6:58 AM

# re: Navision and .NET

Requesting Gravatar...
Thanks. I'll post more about Navision and .NET integration soon. Stay tuned!
Left by Stefano Demiliani on Jun 13, 2005 7:02 AM

# re: Navision and .NET

Requesting Gravatar...
Hello there! I`ve been developing in C# .NET for about a year and I`ve just started working with Navision. The first thing I tried when I found out about the regsvr32 was to create my .net dll and register it into Navision. But no matter what I tried I kept getting the same error. That the dll was "loaded succesfully but registerdll something couldn`t ..." And so I could not find my dll under automation. Is there any interface or something that must be included in the class to register a dll succesfully.. ? Can you please post your vs project so I can have a look? Or is there a setup on my machine.
Left by Edvin Johansen on Jun 22, 2005 7:01 PM

# re: Navision and .NET

Requesting Gravatar...
I'll post the project for sure, I've to find it now... stay tuned!
Strange problem... Have you tryed to set the "Register for COM interop" option to True before compiling? Check this article on how to compile your project:
http://www.codeproject.com/dotnet/nettocom.asp
However, no strange options are required. Can you see your DLL by including it on a new project on VS.NET?
Left by Stefano Demiliani on Jun 22, 2005 8:34 PM

# re: Navision and .NET

Requesting Gravatar...
Thanks for the link. I`ll read in peace and quiet some day soon, and post back if it solves my problem.
Yes, I can see the DLL by including it on a new project in VS.NET.
Left by Edvin Johansen on Jun 29, 2005 7:02 PM

# re: Navision and .NET

Requesting Gravatar...
Hello again..
Now I tried following the example in the link you gave, but without succeeding. I also tried building and using the different tools in the example, but when using regsvr32 on the dll I keep getting "..*.dll was loaded,but the DllRegisterServer entry point was not found". Some suggestions?
Left by Edvin Johansen on Jul 03, 2005 7:32 AM

# How to write a .NET Control for Microsoft Navision

Requesting Gravatar...
Left by STEFANO DEMILIANI WeBlog on Sep 19, 2005 6:06 AM

# re: Navision and .NET

Requesting Gravatar...
How can i include a .net visual control like a textedit into a subform? i nedd a sample C# code for dll and a sample code from Navision, can you show me a example?

Thank's a lot.
Left by Luis on Mar 12, 2008 6:39 PM

# re: Navision and .NET

Requesting Gravatar...
Hello,

I have a problem and, maybe, you can help me. I want connect with navision's database from .Net application using C/ODBC but i don't know how do it. Always the exception "table does not exists" or "unexpected extra token" :(

The code is this:


Dim connString As String = "Dsn=NAVISION- EVIALIS;uid=FCC;pwd=xxxxx;Database=AGRO.FDB"

If connection.State = ConnectionState.Closed Then
connection.Open()
End If

If connection.State = ConnectionState.Open Then
command.Connection = connection
command.CommandText = "Select * from [Table 337 Reservation Entry]"
result = command.ExecuteNonQuery()
connection.Close()
end if

Can you help me please?

Thank you very much.
Left by Antonio Fernández on Jun 26, 2008 9:45 AM

# re: Navision and .NET

Requesting Gravatar...
Hello, is it possible to explain how i can use the Navision native database as datasource in VB.NET.

Thanks in advance
Left by Gregory on Apr 20, 2009 3:23 PM

# re: Navision and .NET

Requesting Gravatar...
Hi,
How can I do that using wcf technology???
I want to connect MS Dynamics Navision with MS Dynamics CRM using WCF Technology, anyone can help me please????
Left by Hanen on Apr 01, 2010 1:28 PM

# replica jewelry

Requesting Gravatar...
Hello, is it possible to explain how i can use the Navision native database as datasource in VB.NET.

Left by replica jewelry on Apr 29, 2010 4:17 AM

# re: Navision and .NET

Requesting Gravatar...
Dear sir ,
This article is very nice. if u have some more documents and articles in this(.Net and navision integration)plz send my email id is mailmehemu1985@gmail.com
Left by hemu on May 14, 2010 2:21 PM

# re: Navision and .NET

Requesting Gravatar...
Hi Stefano,

I want to ask help, I'm creating dll function on C#, and Navision already recognized it as automation.
My question is, I'm creating the function on .NET which have output = datatable, how can I receive this output on Navision ?

thanks you for your help.

Ferry
Left by Ferry on May 28, 2010 10:43 AM

# re: Navision and .NET

Requesting Gravatar...
Nice article!

I have tried to use my c#.net dll in navision but the dll is being only loaded not register...
Left by dpk on Sep 11, 2010 2:25 PM

Your comment:

 (will show your gravatar)
 
Please add 5 and 3 and type the answer here: