How to change [propputref] to [propput]

  • Thread starter Thread starter oleg
  • Start date Start date
O

oleg

Hello!

I developed COM Type Library in C#! This Com used by VB6.0,
but when from vb called some property of com object ,happen error "Object
required"!!!
Part of C# COM:
public object xxx
{
get
{
return 2;
}
set
{
qq=2;
}
}
generated .tlb file:
[id(0x6002000d), propget]// for get
VARIANT xxx();
[id(0x6002000d), propputref]// for set
void xxx([in] VARIANT rhs);
I think, problem in propputref attribute! Which attribute i need to set in
C# code to change [propputref] to [propput] ??

thanks for help
 
Oleg,

Unfortunately, you can't place an attribute in C# (from what I can tell,
I've tried to work around this before). What you can do is use a tool like
OLE View on the TLB that is exported, getting the IDL. Then, copy that and
paste it into a new file. Once you have that, change the property
accordingly (the attribute on the property, that is), and then compile using
IDL compiler (MIDL).

Hope this helps.
 
Hi Oleg,
public object xxx

should be changed to

public int xxx.

"object" is a reference type and thus causes the [propputref] attribute to
be exported to the type library. "int", on the other hand, is a value type
and should be therefore passed by value.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

oleg said:
Hello!

I developed COM Type Library in C#! This Com used by VB6.0,
but when from vb called some property of com object ,happen error "Object
required"!!!
Part of C# COM:
public object xxx
{
get
{
return 2;
}
set
{
qq=2;
}
}
generated .tlb file:
[id(0x6002000d), propget]// for get
VARIANT xxx();
[id(0x6002000d), propputref]// for set
void xxx([in] VARIANT rhs);
I think, problem in propputref attribute! Which attribute i need to set in
C# code to change [propputref] to [propput] ??

thanks for help
 
Thanks!!!

But I need exectly public object xxx!!

Dmitriy Lapshin said:
Hi Oleg,
public object xxx

should be changed to

public int xxx.

"object" is a reference type and thus causes the [propputref] attribute to
be exported to the type library. "int", on the other hand, is a value type
and should be therefore passed by value.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

oleg said:
Hello!

I developed COM Type Library in C#! This Com used by VB6.0,
but when from vb called some property of com object ,happen error "Object
required"!!!
Part of C# COM:
public object xxx
{
get
{
return 2;
}
set
{
qq=2;
}
}
generated .tlb file:
[id(0x6002000d), propget]// for get
VARIANT xxx();
[id(0x6002000d), propputref]// for set
void xxx([in] VARIANT rhs);
I think, problem in propputref attribute! Which attribute i need to set in
C# code to change [propputref] to [propput] ??

thanks for help
 
ðÏÈÏÖÅ ÔÙ ÔÏÖÅ ÉÚ òÏÓÓÉÉ!!!
óÐÁÓÉÂÏ ÚÁ ÓÏ×ÅÔ!!!!
Dmitriy Lapshin said:
Hi Oleg,
public object xxx

should be changed to

public int xxx.

"object" is a reference type and thus causes the [propputref] attribute to
be exported to the type library. "int", on the other hand, is a value type
and should be therefore passed by value.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

oleg said:
Hello!

I developed COM Type Library in C#! This Com used by VB6.0,
but when from vb called some property of com object ,happen error "Object
required"!!!
Part of C# COM:
public object xxx
{
get
{
return 2;
}
set
{
qq=2;
}
}
generated .tlb file:
[id(0x6002000d), propget]// for get
VARIANT xxx();
[id(0x6002000d), propputref]// for set
void xxx([in] VARIANT rhs);
I think, problem in propputref attribute! Which attribute i need to set in
C# code to change [propputref] to [propput] ??

thanks for help
 
Oleg,

I'm from Ukraine actually, and speaking Russian won't be appreciated in this
international newsgroup. May I ask why would you need a property of type
object? Probably we are solving the consequence instead of the reason?

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

oleg said:
Thanks!!!

But I need exectly public object xxx!!

Dmitriy Lapshin said:
Hi Oleg,
public object xxx

should be changed to

public int xxx.

"object" is a reference type and thus causes the [propputref] attribute to
be exported to the type library. "int", on the other hand, is a value type
and should be therefore passed by value.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

oleg said:
Hello!

I developed COM Type Library in C#! This Com used by VB6.0,
but when from vb called some property of com object ,happen error "Object
required"!!!
Part of C# COM:
public object xxx
{
get
{
return 2;
}
set
{
qq=2;
}
}
generated .tlb file:
[id(0x6002000d), propget]// for get
VARIANT xxx();
[id(0x6002000d), propputref]// for set
void xxx([in] VARIANT rhs);
I think, problem in propputref attribute! Which attribute i need to
set
in
C# code to change [propputref] to [propput] ??

thanks for help
 
Back
Top