Hi, I'm having some problems with passing an XML document to a VB .NET component I've created.
I'm trying to create a shipment schedule similar in functionality as the production schedule in Navision 4.0
I've created a Setup table that stores a BLOB...And an XMLPort that generates the XML.
I'm still a "Junior" developper so bear with me here

recShipSchedSetup.LOCKTABLE();
recShipSchedSetup.GET();
recShipSchedSetup.GanttXML.CREATEOUTSTREAM(lostXMLSource); //GanttXML is the BLOB
xptScheduleShipment.SETDESTINATION(lostXMLSource);
xptScheduleShipment.InitializeHeader(rSalesHeader,TRUE,datDateFilter); //Sets a filter in the XMLPort
IF xptScheduleShipment.EXPORT THEN BEGIN
autOutboundXML.load(lostXMLSource);
the autOutboundXML is an Automation variable of type "Microsoft XML, 4.0, DOMDocument40"
xptScheduleShipment is the XMLPort.
To pass the document to VB i'v made this code in navision after the autOutboundXML variable has been filled.
...
CREATE(autGantt);
autGantt.ShowForm(autOutboundXML);
...
autGantt is a DLL i've created in VB .NET... the showForm funtion expects a XMLDocument to be passed..
Public Function ShowFrom(ByRef XMLDoc As MSXML2.DOMDocument40) As Integer Implements _Wrapper.ShowForm
.....
End Function
When running this function from Navision is get an error...I've found out why this error occurs but I do not know how to solve it.
When changing the type of XMLDoc in the VB code to Object...and then displaying the object type in a messagebox I get System._ComObject as type instead of MSXML2.DOMDocument40.
Public Function ShowFrom(ByRef XMLDoc As Object) As Integer Implements _Wrapper.ShowForm
MessageBox.Show(XMLDoc.GetType.ToString)
End Function
So the variable I pass from navision isn't an MSXML2.DOMDocument40 but a System._ComObject. I tried converting the variable in VB, but that doesn't work.
Has anyone had any experience with this? Or does anyone know how to pass this XMLDocument to VB .NET?
Thanks in advance
Comments
what are you doing within your VB.Net DLL ?
"Public Function ShowFrom(ByRef XMLDoc As MSXML2.DOMDocument40) As Integer Implements _Wrapper.ShowForm
.....
End Function"
It is possible to use the MSXML4 as Reference for your own functions.
When you try to show the XML-String use
MessageBox.Show(XMLDoc.Text) or
MessageBox.Show(XMLDoc.XML)
Stefan
When I do CREATE(autDll) Navision says it cannot create an instance of the class.
I think I'm doing something wrong in the VB Code with the DLL. Does anyone know how to create a dll so I can register it to COM and navision can see the public functions?
Here's the code i've got now:
I got this code from the net here: http://www.codeproject.com/dotnet/nettocom.asp
So I followed their instructions to create the DLL. It used to work fine before but since yesterday I've been getting errors. When I use the OLEView tool of Microsoft Visual Studio and try to create an instance of it by double clicking on the COM, I get:
IClassFactory::CreateInstance failed
Severity: SEVERITY_ERROR, facility: <Unknown>, ...
Anyone know what's the problem here?