473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Interface from C# to VB 6 not working

I am working on an existing .NET (C Sharp) component that had a com
interface that was used by a VB component. When it was originally
written, it had the SSEAssemblyCom class below - minus the two last
methods (for space I modified method names in my example below). I
added those. Everything but the two new methods I added referenced
the ISSEAssemblyCom interface below.

I was told I would need to create a secondary interface
(ISSEAssemblyCom2 below) that SSEAssemblyCom would use which I've done
as you can see in the code below. I created a tlb file for my .NET
component to use by my VB component and reference it and now my VB
component is only recognizing the two new methods I wrote and not any
of the other ones. I checked with a developer in my company and he
had me try putting the methods from ISSEAssemblyCom into
ISSEAssemblyCom2 and try it again. I did that and now my VB component
recognizes the first 12 but not the 2 new ones I added...??? Does
anyone know how this is supposed to be done properly so that I can
reference both the old and new interface methods? (By the way, I took
out the code below in each method of SSEAssemblyCom as I figured you'd
only care about the signatures anyways)

[ComVisible(true), ClassInterface(ClassInterfaceType.None)]
[Guid("A GUID VALUE HERE")]
[ProgId("PLXX0005.SSEAssemblyCom")]
public class SSEAssemblyCom : ISSEAssemblyCom, ISSEAssemblyCom2
{
public void Method1(string sz)
public void Method2(string sz)
public bool Method3(string sz, string sz2, out string sz3, int i)
public bool Method4(string sz, out string sz2, int i)
public void Method5(string sz)
public void Method6(string sz)
public string Method7(string sz)
public bool Method8(string sz, out string sz2, int i)
public void Method9(string sz, string sz2)
public bool Method10(string sz, out string sz2, int i)
public bool Method11(string sz)
public void Method12(string sz, string sz2)
public void MyNewMethod1(string sz, out string sz2)
public bool MyNewMethod2(string sz, out string sz2)
}

[ComVisible(true)]
[Guid("ANOTHER GUID VALUE HERE")]
public interface ISSEAssemblyCom
{
[DispId(1)] void Method1(string sz)
[DispId(2)] void Method2(string sz)
[DispId(3)] bool Method3(string sz, string sz2, out string sz3,
int i)
[DispId(4)] bool Method4(string sz, out string sz2, int i)
[DispId(5)] void Method5(string sz)
[DispId(6)] void Method6(string sz)
[DispId(7)] string Method7(string sz)
[DispId(8)] bool Method8(string sz, out string sz2, int i)
[DispId(9)] void Method9(string sz, string sz2)
[DispId(10)] bool Method10(string sz, out string sz2, int i)
[DispId(11)] bool Method11(string sz)
[DispId(12)] void Method12(string sz, string sz2)
}

[ComVisible(true)]
[Guid("A THIRD GUID VALUE HERE")]
public interface ISSEAssemblyCom2 : ISSEAssemblyCom
{
[DispId(13)] void MyNewMethod1(string sz, out string sz2)
[DispId(14)] bool MyNewMethod2(string sz, out string sz2)
}
Nov 15 '05 #1
4 2555
Try marking the interface you want to consume with the attribute:

[InterfaceTypeAttribute(ComInterfaceType.InterfaceI sIDispatch)]
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Doug" <dn******@dtgnet.com> wrote in message
news:ff**************************@posting.google.c om...
I am working on an existing .NET (C Sharp) component that had a com
interface that was used by a VB component. When it was originally
written, it had the SSEAssemblyCom class below - minus the two last
methods (for space I modified method names in my example below). I
added those. Everything but the two new methods I added referenced
the ISSEAssemblyCom interface below.

I was told I would need to create a secondary interface
(ISSEAssemblyCom2 below) that SSEAssemblyCom would use which I've done
as you can see in the code below. I created a tlb file for my .NET
component to use by my VB component and reference it and now my VB
component is only recognizing the two new methods I wrote and not any
of the other ones. I checked with a developer in my company and he
had me try putting the methods from ISSEAssemblyCom into
ISSEAssemblyCom2 and try it again. I did that and now my VB component
recognizes the first 12 but not the 2 new ones I added...??? Does
anyone know how this is supposed to be done properly so that I can
reference both the old and new interface methods? (By the way, I took
out the code below in each method of SSEAssemblyCom as I figured you'd
only care about the signatures anyways)

[ComVisible(true), ClassInterface(ClassInterfaceType.None)]
[Guid("A GUID VALUE HERE")]
[ProgId("PLXX0005.SSEAssemblyCom")]
public class SSEAssemblyCom : ISSEAssemblyCom, ISSEAssemblyCom2
{
public void Method1(string sz)
public void Method2(string sz)
public bool Method3(string sz, string sz2, out string sz3, int i)
public bool Method4(string sz, out string sz2, int i)
public void Method5(string sz)
public void Method6(string sz)
public string Method7(string sz)
public bool Method8(string sz, out string sz2, int i)
public void Method9(string sz, string sz2)
public bool Method10(string sz, out string sz2, int i)
public bool Method11(string sz)
public void Method12(string sz, string sz2)
public void MyNewMethod1(string sz, out string sz2)
public bool MyNewMethod2(string sz, out string sz2)
}

[ComVisible(true)]
[Guid("ANOTHER GUID VALUE HERE")]
public interface ISSEAssemblyCom
{
[DispId(1)] void Method1(string sz)
[DispId(2)] void Method2(string sz)
[DispId(3)] bool Method3(string sz, string sz2, out string sz3,
int i)
[DispId(4)] bool Method4(string sz, out string sz2, int i)
[DispId(5)] void Method5(string sz)
[DispId(6)] void Method6(string sz)
[DispId(7)] string Method7(string sz)
[DispId(8)] bool Method8(string sz, out string sz2, int i)
[DispId(9)] void Method9(string sz, string sz2)
[DispId(10)] bool Method10(string sz, out string sz2, int i)
[DispId(11)] bool Method11(string sz)
[DispId(12)] void Method12(string sz, string sz2)
}

[ComVisible(true)]
[Guid("A THIRD GUID VALUE HERE")]
public interface ISSEAssemblyCom2 : ISSEAssemblyCom
{
[DispId(13)] void MyNewMethod1(string sz, out string sz2)
[DispId(14)] bool MyNewMethod2(string sz, out string sz2)
}

Nov 15 '05 #2
Hi Chris,
That didn't work either. I got the same results as before even
with adding that attribute.

I tried creating a brand new class (SSEAssemblyCom2) that
inherited from the new interface (ISSEAssemblyCom2), and I could see
the first 12 methods in the intellisense in VB when I use
SSEAssemblyCom and the last two methods where I use SSEAssemblyCom2,
however actually creating the object in VB failed for SSEAssemblyCom2
so I'm at a complete loss at what to do here.
Nov 15 '05 #3
Hi Chris,
That didn't work either. I got the same results as before even
with adding that attribute.

I tried creating a brand new class (SSEAssemblyCom2) that
inherited from the new interface (ISSEAssemblyCom2), and I could see
the first 12 methods in the intellisense in VB when I use
SSEAssemblyCom and the last two methods where I use SSEAssemblyCom2,
however actually creating the object in VB failed for SSEAssemblyCom2
so I'm at a complete loss at what to do here.
Nov 15 '05 #4
Just a quick update. I have attempted the following to get around
this problem and nothing works. If anyone has any ideas as to how I
can get two new methods from C# to be called through VB in an
interface I would love to hear it...:)

1) Tried with just the old interface with 12 methods and got rid of
my two new ones - this worked just fine but since I need the new
ones...:)

2) Added two new methods to old interface - old methods worked, new
ones caused "Object doesn't support this property or method" error.

3) Left old interface with two new methods - changed the guid -
caused "Type Mismatch" error when object was being created.

4) Created new interface with two new methods, had my class inherit
from both the old and new interface - VB does not show the new methods
in intellisense and trying to call them causes "Object doesn't support
this property or method" error (interestingly enough if I change my
class to inherit from the new class first and the old class second,
then the old methods don't show up in intellisense, the new ones do).

5) In new interface, had it inherit from old interface and had my
class inherit just from new interface - VB does not show the old
methods in intellisense and trying to call them causes "Object doesn't
support this property or method" error.

6) In old interface, had it inherit from new interface - VB does not
show the new methods in intellisense and trying to call them causes
"Object doesn't support this property or method" error.

7) In new interface, removed inheritance from old interface - put
methods from old interface in new interface, had class inherit from
new interface only. VB shows all methods in intellisense, but throws
"Object doesn't support this property or method" error when calling
old methods. New method calls work just fine.

8) Kept new and old interface, had class inherit from old interface.
Created brand new class and had it inherit from new interface. Create
a seperate object in VB to call new methods that would use new class
from C# code. When object attempted to get created got the error:
"Could not load type PLXX0005.SSEAssemblyCom2 from assembly PLXX0005.
PLXX0005.SSEAssemblyCom2"
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Doug | last post by:
I am working on an existing .NET (C Sharp) component that had a com interface that was used by a VB component. When it was originally written, it had the SSEAssemblyCom class below - minus the two...
9
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
175
by: Ken Brady | last post by:
I'm on a team building some class libraries to be used by many other projects. Some members of our team insist that "All public methods should be virtual" just in case "anything needs to be...
3
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability....
20
by: Ole Hanson | last post by:
I am accessing my database through an interface, to allow future substitution of the physical datastore - hence I would like to declare in my Interface that my DAL-objects implementing the...
2
by: Todd Brooks | last post by:
I have a coclass that implements a dual interface. The thing that's a little unusual is that the coclass doesn't inherit directly from the interface, rather it inherits from an implementation class...
0
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that...
7
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should...
2
by: nibin | last post by:
pls help me it urgent i m facing a problem with my vb.net code this is the code equivalent in c# this is the interface...........
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.