473,513 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.NET COM Interface Issue.

1 New Member
I am trying to define a C# interface that will return a root object as I have defined below as Class Root. Within I have a prop that has an array of my custom ItemX objects that I would like to return as well. My definition seems correct since I can see the values in my Locals Window while debugging in VB 6.0 but I cannot get to the value named "s"! Has anyone ever seen this or solved or did I screw something up?

Thanks!


Visual Basic 6.0 Code:

Set obj = CreateObject("Test.Demo")
Set x = obj.Test
MsgBox x.Name ' This works well
'Next line I can see all values in Locals Window in VB debugger. WTF?
MsgBox x.ItemX(0).s


C# Code for COM interface:

[Guid("305CDAE0-573E-4350-801C-5E7D680877A5")]
[ClassInterface(ClassInterfaceType.None), ComVisible(true)]
[ProgId("Test.Demo")]
public class Demo : _Demo
{

public Root TEST()
{
Root rr = new Root();
return rr;
}
}

[Guid("AC81FAC9-294C-4652-AAAF-72EB2B0B00C9")]
[InterfaceType(ComInterfaceType.InterfaceIsDual), ComVisible(true)]
public interface _Demo
{
[DispId(1)]
Root TEST();
}

[Guid("2EB573B4-742B-431a-9653-A12D870A791B")]
[InterfaceType(ComInterfaceType.InterfaceIsDual), ComVisible(true)]
public interface _Root
{

ItemX[] itemList
{
[DispId(1)]
get;
[DispId(2)]
set;
}

string Name
{
[DispId(3)]
get;
[DispId(4)]
set;
}
}

[Guid("1368376B-518F-41fe-8236-E224559D705D")]
[ClassInterface(ClassInterfaceType.None), ComVisible(true)]
[ProgId("DEMONS.Root")]
public class Root : _Root
{
private string m_name = "SOME VALUE";
private ItemX[] m_Items = new ItemX[3];

public Root()
{
for (int ii = 0; ii < 3; ii++)
{
m_Items[ii] = new ItemX();
}
}


public ItemX[] itemList
{
get
{
return m_Items;
}
set
{
m_Items = value;
}
}
public string Name
{
get
{
return m_name;
}
set
{
m_name = value;
}
}
}


[Guid("C6F992B2-E8DA-4921-8F70-FC3B0B0A37DD")]
[InterfaceType(ComInterfaceType.InterfaceIsDual), ComVisible(true)]
public interface _ItemX
{
string s
{
[DispId(3)]
get;
[DispId(4)]
set;
}
}

[Guid("B031BB31-F592-45fc-AB07-F69B64E7695A")]
[ClassInterface(ClassInterfaceType.None), ComVisible(true)]
[ProgId("DEMONS.Item")]
public class ItemX : _ItemX
{
private string m_s = "ME";
public string s
{
get
{
return m_s;
}
set
{
m_s = value;
}
}
}
Sep 12 '07 #1
0 844

Sign in to post your reply or Sign up for a free account.

Similar topics

4
8171
by: Roy Pereira | last post by:
I have an application that is composed of a set of "Content" dlls and a viewer application. The viewer calls a standard set of functions that are present in all the dlls. I maintain this by...
175
8650
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...
7
3641
by: yufufi | last post by:
lets say we have a 'shape' class which doesn't implement IComparable interface.. compiler doesn't give you error for the lines below.. shape b= new shape(); IComparable h; h=(IComparable)b;...
4
6979
by: Guy | last post by:
Hi i have a base class (marked 'MustInherit') with a public property called IsValid and a public event called Vali i have a class (lets call it 'Client') that inherits this base class so the...
2
1609
by: Kevin Frey | last post by:
Consider this simple example: interface IReader { bool Read( ); }; class MyReader : IReader { bool Read( ); // or should it be bool IReader.Read( ) ?
6
1765
by: Dave Booker | last post by:
I want to do something like this: public class Animal; public interface IZoo { List<Animal> Animals { get; } void Feed(Animal a); }
20
6045
by: Luc Kumps | last post by:
(Sorry about the previous post, it got transmitted before it was complete) We try to separate implementation and interface defintions, but we run into a problem. I hope the guru's can solve this,...
0
2492
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...
52
20813
by: Ben Voigt [C++ MVP] | last post by:
I get C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member...
7
10576
by: WTH | last post by:
I am now aware (I am primarily a C++ developer) that in C# if you reference the same interface from the same file in two different projects the types are actually incompatible. I found this out...
0
7265
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
7171
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...
0
7545
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...
1
7111
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...
0
7539
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5095
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...
0
3240
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...
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
461
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...

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.