473,732 Members | 2,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
(ISSEAssemblyCo m2 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
ISSEAssemblyCom 2 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( ClassInterfaceT ype.None)]
[Guid("A GUID VALUE HERE")]
[ProgId("PLXX000 5.SSEAssemblyCo m")]
public class SSEAssemblyCom : ISSEAssemblyCom , ISSEAssemblyCom 2
{
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(st ring sz, out string sz2)
public bool MyNewMethod2(st ring 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 ISSEAssemblyCom 2 : ISSEAssemblyCom
{
[DispId(13)] void MyNewMethod1(st ring sz, out string sz2)
[DispId(14)] bool MyNewMethod2(st ring sz, out string sz2)
}
Nov 15 '05 #1
4 2581
Try marking the interface you want to consume with the attribute:

[InterfaceTypeAt tribute(ComInte rfaceType.Inter faceIsIDispatch )]
--
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******@dtgne t.com> wrote in message
news:ff******** *************** ***@posting.goo gle.com...
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
(ISSEAssemblyCo m2 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
ISSEAssemblyCom 2 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( ClassInterfaceT ype.None)]
[Guid("A GUID VALUE HERE")]
[ProgId("PLXX000 5.SSEAssemblyCo m")]
public class SSEAssemblyCom : ISSEAssemblyCom , ISSEAssemblyCom 2
{
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(st ring sz, out string sz2)
public bool MyNewMethod2(st ring 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 ISSEAssemblyCom 2 : ISSEAssemblyCom
{
[DispId(13)] void MyNewMethod1(st ring sz, out string sz2)
[DispId(14)] bool MyNewMethod2(st ring 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 (SSEAssemblyCom 2) that
inherited from the new interface (ISSEAssemblyCo m2), 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 (SSEAssemblyCom 2) that
inherited from the new interface (ISSEAssemblyCo m2), 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.SSEAss emblyCom2 from assembly PLXX0005.
PLXX0005.SSEAss emblyCom2"
Nov 15 '05 #5

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

Similar topics

0
270
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 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...
9
4646
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
8868
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 changed". This is very much against my instincts. Can anyone offer some solid design guidelines for me? Thanks in advance....
3
4140
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. The User Experience, or how the user experiences the end product, is the key to acceptance. And that is where User Interface Design enters the design process. While product engineers focus on the technology, usability specialists focus on the user...
20
4259
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 interface and accessing the datastore MUST pass in a UserToken in the constructor of the object. Is this not possible? Am I forced to add the UserToken as a property on the object instead? /Ole
2
3453
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 that inherits from the interface. This means that by default the attribute code generator doesn't pick up the interface. According to the docs, I should be able to use the implements() attribute to tell the compiler that the coclass implements...
0
2508
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 don't work nearly as well as they should, even for analysts and power users. The reason they haven't reached the masses is because most of the tools are so difficult to use and reveal so little
7
9368
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 display the Windows form. The form is being displayed but the command only returns when the form is closed. I want the command line to return immediately, leaving the form displayed.
2
3483
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........ ............................................................................................................... namespace x {. public interface ISection {
0
8944
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8773
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9306
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9234
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3259
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.