Question Get an array back from a .net DLL

XardozCom

Member
Joined
May 10, 2013
Messages
16
Location
Washington State USA
Programming Experience
10+
We have a DLL written in VB9 (.Net 2008 Express) in com wrapper

It is called from our VB6 program and works great.

Recently we need to pass XML from VB6 to a function in our DLL and get an array passed back

The XML parsing works fine, been modified to remove propitiatory information

No luck so far...

VB.NET:
[COLOR=#333333]Public Function GetIfno(ByVal sXML As String) As Array
[/COLOR]
Dim doc As XPathDocument


        If sXML = "" Then
            Dim file = System.IO.File.OpenText("\\Foo\Foo2\FooFum.dat")
            doc = New XPathDocument(file)
        Else
            doc = New XPathDocument(sXML)
        End If


        Dim nav = doc.CreateNavigator()


        Dim manager = New XmlNamespaceManager(nav.NameTable)


        manager.AddNamespace(...)
        manager.AddNamespace(...)


        Dim nodes = nav.Select("/domain:p/pInfo/vs:P[@sysid='2']", manager)
        Dim a(,) As String = Nothing
        Dim iCounter As Integer = -1
        While nodes.MoveNext()
            iCounter += 1
            ReDim Preserve a(iCounter, 1)
            nodes.Current.MoveToNext("name", "")
            a(iCounter, 0) = nodes.Current.Value


            nodes.Current.MoveToNext("desc", "")
            a(iCounter, 1) = nodes.Current.Value
 
        End While


        Return a


    End Function
 
Last edited:
Back
Top