M
Michal
Hi.
I've sent this message earlier, but maybe it wasn't noticed
I didn't find
solution of my
problem
I hope someone can help me here... I promise, I won't post it
again
The problem is:
Im writing a library in C# (COM Library). This library will be used by an
application, which is wrote in VB6. I will call it "MainApp".
In my library I'm reading property from object which is shared from MainApp.
My class looks like:
[Guid("6FA89BBA-A87F-4e0a-8A0D-9B2FA0C7BD53"),
ClassInterface(ClassInterfaceType.None)]
public class MainClass : MainApp.ExternalClass
{
void InitClass(MainApp.Interface myIntrf)
{
MainApp.SomeObj s = myIntrf.MyProperty;
}
}
MainApp.ExternalClass - abstract class (I'm implementing its methods).
When I'm buliding the project, VS says:
"Property, indexer, or event 'MyProperty' is not supported by the language;
try directly calling accessor methods 'MainApp.get_MyProperty()' or
'MainApp.set_MyProperty(ref MainApp.SomeObj)''".
So i changed my code and I'm invoking get_MyPropert() method. Buuuut, when I
want to access some fields in MainApp.SomeObj an exception is thrown:
"System.InvalidCastException: QueryInterface for interface
'MainApp._SomeObj' failed."
What should I do, so my returing (from accessor method) object
('MainApp._SomeObj') is valid ??
I'll be appreciative for any advise...
Michal
I've sent this message earlier, but maybe it wasn't noticed

solution of my
problem

again

The problem is:
Im writing a library in C# (COM Library). This library will be used by an
application, which is wrote in VB6. I will call it "MainApp".
In my library I'm reading property from object which is shared from MainApp.
My class looks like:
[Guid("6FA89BBA-A87F-4e0a-8A0D-9B2FA0C7BD53"),
ClassInterface(ClassInterfaceType.None)]
public class MainClass : MainApp.ExternalClass
{
void InitClass(MainApp.Interface myIntrf)
{
MainApp.SomeObj s = myIntrf.MyProperty;
}
}
MainApp.ExternalClass - abstract class (I'm implementing its methods).
When I'm buliding the project, VS says:
"Property, indexer, or event 'MyProperty' is not supported by the language;
try directly calling accessor methods 'MainApp.get_MyProperty()' or
'MainApp.set_MyProperty(ref MainApp.SomeObj)''".
So i changed my code and I'm invoking get_MyPropert() method. Buuuut, when I
want to access some fields in MainApp.SomeObj an exception is thrown:
"System.InvalidCastException: QueryInterface for interface
'MainApp._SomeObj' failed."
What should I do, so my returing (from accessor method) object
('MainApp._SomeObj') is valid ??
I'll be appreciative for any advise...
Michal