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 / Interop / November 2007

Tip: Looking for answers? Try searching our database.

How to Create an object of VB6 component in C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew HUANG - 09 Nov 2007 14:22 GMT
In our MTS server, there are some component coded by VB6. Now I just try to
verify all component working fine, so I create an object for each component.
Using Type.GetTypeFromCLSID and Activator.CreateInstance (in C#) can create
object ONLY for .NET component.
My question is: How to Create an object of VB6 component in C#?

Thanks,
-Andrew
Mattias Sjögren - 09 Nov 2007 22:12 GMT
>In our MTS server, there are some component coded by VB6. Now I just try to
>verify all component working fine, so I create an object for each component.
>Using Type.GetTypeFromCLSID and Activator.CreateInstance (in C#) can create
>object ONLY for .NET component.
>My question is: How to Create an object of VB6 component in C#?

Activator.CreateInstance should work for pretty much any COM object,
including those written in VB6. If that's not what you're seeing,
perhaps you can tell us where it fails?

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Andrew HUANG - 09 Nov 2007 22:56 GMT
Thanks, Mattias.

For library application, Type.GetTypeFromCLSID return System.__ComObject
instead of object name. After that, Activator.CreateInstance throws an
exception:
{"Retrieving the COM class factory for remote component with CLSID {} from
machine <ServerName> failed due to the following error: 80040154."}

From Microsoft: https://msdn2.microsoft.com/en-us/library/y76yy1s2.aspx

"Return Value
System.__ComObject regardless of whether the CLSID is valid. "

Would you give some advice for this issue?

Thanks,
-Andrew

> >In our MTS server, there are some component coded by VB6. Now I just try to
> >verify all component working fine, so I create an object for each component.
[quoted text clipped - 7 lines]
>
> Mattias

Rate this thread:







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.