Hi
Iam new to this COM.
I need to convert a string to VT_BSTR.
One method is I have my string in c# and i need to pass this as parameter in c++ application where i need to convert it into VT_bstr and return the result in c#.How to do this and where i wil hold the VT_bstr variable in c#.
Another method is how to convert string to VT_bstr in c# itself.
Please help me on this.
Loading

Sam HobbsRank #107 · 20.5K reputationPosted Nov 5, 2010, 3:31 PM EDT
So you need to check the documentation for use of the variant type in C#; that is, how to tell C# that a parameter is a variant.
If the C# truly is a COM object, then you don't need to be concerned about details; just add a reference to the COM object and let C# take care of details. Are you sure it is a COM object?
manju M3 reputationPosted Nov 11, 2010, 9:10 PM EST
Thanks for your reply.
My requirement is i need to fetch value from database and to write the value in AIM OPC server.
The OPC server supports variant type only.
I need to convert the value which is in string in database to variant.
when i referred some dcoument for AIM OPC server, it s given that the equivalent of string is vt_bstr. so i need to convert this into that.
Wat reference i need to add or how to do this?
Sam HobbsRank #107 · 20.5K reputationPosted Nov 11, 2010, 11:30 PM EST
Zbynek Zahradnik13 reputationPosted Mar 24, 2014, 1:00 AM EDT
Achal Kumar19 reputationPosted Jan 17, 2016, 9:37 PM EST