I have made a very simple com class with a function in vb 2005 so i can call this function out of Navision 4.0 SP1.
The code is as follow:
Imports System.Runtime.InteropServices
<InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface INavisionTest
Function Add2Numbers(ByVal a As Integer, _
ByVal b As Integer) As Integer
End Interface
<ClassInterface(ClassInterfaceType.None)> _
Public Class NavisionTest
Implements INavisionTest
Public Function Add2Numbers(ByVal a As Integer, _
ByVal b As Integer) As Integer _
Implements INavisionTest.Add2Numbers
Return (a + b)
End Function
End Class
The function is working fine.
The only thing I noticed is when defining the automation control in Navision the automation server is showing 2 classes (INavisionTest and NavisionTest). So the interface and the class are shown.
The function is only working when the class NavisionTest is selected.
How can I show only the class NavisionTest in Navision when defining the automation control? ](*,)
0
Answers
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
When you now use the automation control in navision you only see all the default COM methods and properties (Equals, GetHashCode, GetType, ToString etc.).
The custom made function Add2Numbers is not accessable anymore.
You could also just leave it the way it is, take a look at a few other automation servers eg. NEP Queue Handler, Navision Communication Component version 2, Microsoft Outlook 11.0 Object Library
You'll see duplicate methods like Application, _Application, MessageQueueListener, IMessageQueueListener
I personally wouldn't worry too much about it as it seems to be a common occurrence.
It works, but it will be recommended not to use.
I leave it as it is.