Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 26th, 2004, 07:56 PM
MIB MIB is offline
Registered User
 
Join Date: Jun 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access Vb6 Com Interface in C# . please help thank

HI
I got VB6 com interface "LANNTBSMTSCOMP" and VB6 COM object "CLANC".
The probject reference "LANNTBSMTSCOMP" only.

In VB.NET project I call call "CLANC" without any problem as below:
Code:
Dim lvobjClientLogon As LANNTBSMTSCOMP.IlancClientLogon
Dim lvstrChallenge As String
        lvobjClientLogon = CreateObject("CLANC.CClientLogon")
        lvstrChallenge = lvobjClientLogon.GetLogonChallenge("1", "2", "3", "4", "5", "6")
But I cant do it in C#... Can anyone help me? I try code as below:
Code:
Type objClientLogonType = Type.GetTypeFromProgID("CLANC.CClientLogon");
LANNTBSMTSCOMP.IlancClientLogon    lvobjClientLogon;
lvobjClientLogon =(LANNTBSMTSCOMP.IlancClientLogon)Activator.CreateInstance(objClientLogonType);
object[] objArgues = {"1", "2", "3", "4", "5", "6"};
object c = objClientLogonType.InvokeMember("GetLogonChallenge", BindingFlags.InvokeMethod, null, lvobjClientLogon, objArgues);
Console.Writelin(c.ToString());
in C# i got error :

Unhandled Exception: System.Runtime.InteropServices.COMException (0x80020006): U
nknown name.

Can anyone help me for this??

thanks
 
Old April 27th, 2004, 02:31 AM
Registered User
 
Join Date: Apr 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to nagendrakumar_b
Default

HI,

i understood ur problem, although i'm not well explored to c# but i'm well aware of vb.net.The solution might be related to the difference of using interfaces in vb6 with the other language(including vb.net). DOn't try use the interface object by castingthe orginial object to it. Just do it in reverse way.


 
Old April 28th, 2004, 08:28 AM
Authorized User
 
Join Date: Jun 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi MIB,

Try to create a Runtime Callable Wrapper using tlbimp.exe utility in .NET...Then try your code in C#... Actually when accessing COM components from .NET app, one needs to create a RCW...you can get to know abt how to use the utility in MSDN documentation...

HTH.

cheers
Debsoft



Quote:
quote:Originally posted by MIB
 HI
I got VB6 com interface "LANNTBSMTSCOMP" and VB6 COM object "CLANC".
The probject reference "LANNTBSMTSCOMP" only.

In VB.NET project I call call "CLANC" without any problem as below:
Code:
Dim lvobjClientLogon As LANNTBSMTSCOMP.IlancClientLogon
Dim lvstrChallenge As String
        lvobjClientLogon = CreateObject("CLANC.CClientLogon")
        lvstrChallenge = lvobjClientLogon.GetLogonChallenge("1", "2", "3", "4", "5", "6")
But I cant do it in C#... Can anyone help me? I try code as below:
Code:
Type objClientLogonType = Type.GetTypeFromProgID("CLANC.CClientLogon");
LANNTBSMTSCOMP.IlancClientLogon    lvobjClientLogon;
lvobjClientLogon =(LANNTBSMTSCOMP.IlancClientLogon)Activator.CreateInstance(objClientLogonType);
object[] objArgues = {"1", "2", "3", "4", "5", "6"};
object c = objClientLogonType.InvokeMember("GetLogonChallenge", BindingFlags.InvokeMethod, null, lvobjClientLogon, objArgues);
Console.Writelin(c.ToString());
in C# i got error :

Unhandled Exception: System.Runtime.InteropServices.COMException (0x80020006): U
nknown name.

Can anyone help me for this??

thanks
cheers,
debsoft





Similar Threads
Thread Thread Starter Forum Replies Last Post
MS ACCESS, VBA and Configuring a Serial Interface vbaaccess VB How-To 1 February 21st, 2008 05:07 PM
Access Forms - Multiple User Interface nadhan_f BOOK: Access 2003 VBA Programmer's Reference 1 October 23rd, 2007 04:37 PM
open Access report from VB6 submit Pro VB 6 7 December 6th, 2005 04:04 PM
how to use vb6 to access the "IE history folder" winlinux Beginning VB 6 1 April 4th, 2004 05:44 PM
load report from access to vb6 kclau VB Databases Basics 0 August 20th, 2003 03:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.