Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / February 2008

Tip: Looking for answers? Try searching our database.

Can't Access XML from VB6 dll

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
iain010100@gmail.com - 21 Feb 2008 16:41 GMT
How to I get access to a MSXML2.FreeThreadedDOMDocument60 document in
a Microsoft Visual C# 2005 dot net project?

I'm writing a dot net executable that needs to access a by ref XML dom
from a Visual Basic 6 dll. The dll returns XML but I'm not sure how to
type the XML object.

// Dot NET Class
vb6Project.myClass vb6DataObject = new vb6Project.myClass();
MSXML2.IXMLDOMDocument2 _testxml = new MSXML2.IXMLDocument2();
vb6DataObject.GetData(ref _theXml);

// VB 6 Class
Private Function iTheProject_GetData(ByRef theXml As
MSXML2.FreeThreadedDOMDocument60) As Boolean
   set theXml = getXMLDoc()
end function

With all the things I've tried, I get one of two errors:

Error 1 Cannot create an instance of the abstract class or interface
'MSXML2.IXMLDOMDocument2'

or

cannot convert from '[ref MSXML2.FreeThreadedDOMDocument]' to 'ref
MSXML2.IXMLDOMDocument2'

Maybe there's a lot more to it then just passing in the correct
object? Any help and/or code examples will be greatly appreciated.

-- i
Anthony Jones - 21 Feb 2008 22:30 GMT
> How to I get access to a MSXML2.FreeThreadedDOMDocument60 document in
> a Microsoft Visual C# 2005 dot net project?
[quoted text clipped - 26 lines]
> Maybe there's a lot more to it then just passing in the correct
> object? Any help and/or code examples will be greatly appreciated.

It looks to me that getXMLDoc in the VB6 app is creating the object so stop
using new MSXML2.IXMLDocument2 in the C#.

Since MSXML2.FreeThreadedDOMDocument and MSXML2.IXMLDOMDocument2 are
different types you can't pass one to the other ByRef.

If you change the GetData signature to:-

GetData(ByRef theXml as MSXML2.IXMLDOMDocument2)

then that may work.

However the Function is declared Private so I'm not sure how your C# manages
to call it anyway.  Also why use a ByRef parameter?  Can't the function
simply return the DOM instead.

Signature

Anthony Jones - MVP ASP/ASP.NET


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.