Click to See Complete Forum and Search --> : How to create an Automation DLL?


kvaes
October 6th, 2005, 06:59 AM
Hi, I'm having a bit of a problem here...I want to create a DLL in VB .NET and register it so that MBS Navision can execute the public functions of that class.

It used to work fine. But all of a sudden I get errors in navision saying that it cannot create an instance of the automation class.

I don't have any experience with creating DLL's so I found this on the Net and used it in my VB Project:

Imports System
Imports System.Xml
Imports System.Runtime.InteropServices
Imports NETRONIC.XGantt

Namespace cWrapper

<Guid("89439AD1-756F-4f9c-BFB4-18236F63251E"), _
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface _cWrapper
<DispId(1)> Function ScheduleShipment(ByVal fileLocation As String) As Integer
End Interface


<Guid("1376DE24-CC2D-46cb-8BF0-887A9CAF3014"), _
ClassInterface(ClassInterfaceType.None), _
ProgId("Wrapper.Numbers")>
Public Class cWrapper
Implements _cWrapper

Public Function ScheduleShipment(ByVal fileLocation As String) As Integer Implements _cWrapper.ScheduleShipment
MessageBox.Show(fileLocation)
....
End Function

Public Sub New()
MyBase.New()
End Sub

End Class

End Namespace

The DLL shows up in my registry after I register it. But I cannot create an instance of it. Anyone know what's wrong here? Or does anyone know a better way to create a DLL or OCX? So that I do not need to use the interface and all the <Guid("89439AD1-756F-4f9c-BFB4-18236F63251E"), _
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _ ....code ?

Thanks in advance ;)

kvaes
October 6th, 2005, 07:20 AM
I looked for the Object in the Visual Basic 6 Ole View tool. When creating an instance there i get an error that says:

IClassFactory::CreateInstance Failed