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;
}
}
}