473,287 Members | 2,682 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

deriving COM class compiles in C#, doesnt in VB.net

Hi All,

I need to derive a class in VB.Net from a COM interface declared in an idl
file in a VC++ project. Here is the interface declaration:
-----------------------------------------------------
[
uuid(FC567B40-956B-11e1-9996-008765B53180),
helpstring(""),
version(1.0),
nonextensible,
dual,
oleautomation,
pointer_default(unique)
]
interface IParameter : IDispatch {

[propget, helpstring("")]
HRESULT _stdcall ID([out, retval] long* );

[id(0), propget, helpstring("") ]
HRESULT _stdcall Value([out, retval] VARIANT*);

[id(0), propput]
HRESULT _stdcall Value([in] VARIANT NewValue);

[id(0), propputref]
HRESULT _stdcall Value([in] VARIANT* NewValue);

};
---------------------------------------------------------
I implemented this in vb.net:

Imports System
Imports CBOM

Namespace shit_in_vb

Public Class wrapper
Implements CBOM.IParameter

Public Sub New()
End Sub

Sub let_Value(ByVal __MIDL_0224 As Object) Implements
IParameter.let_Value
End Sub

Public ReadOnly Property ID() As Integer Implements IParameter.ID
Get
Return 0
End Get
End Property

Public Property Value() As Object Implements IParameter.Value
Get
Return Nothing
End Get

Set(ByVal Value As Object)
End Set
End Property

End Class

End Namespace
---------------------------------------------------------
And it gives the following compile errors:
C:\Projects\MSB-xxx\source\Core\CBOMLib\CBOMLib.NET\Parameter.vb(5 ) : error
BC30154: 'CBOMLib.Parameter' must implement 'Overridable Overloads Property
Value() As Object' for interface 'CBOM.IParameter'. Implementing property
must have matching 'ReadOnly'/'WriteOnly' specifiers.
C:\Projects\MSB-xxx\source\Core\CBOMLib\CBOMLib.NET\Parameter.vb(1 05) :
error BC30401: 'IParameter_Value' cannot implement 'Value' because there is
no matching property on interface 'IParameter'.

But I was able to derive from this interface in C# (following code compiles
wo warnings):

---------------------------------------------------------
using System;
using CBOM;
namespace shit_in_see_sharp
{
/// <summary>
/// Summary description for wrapper.
/// </summary>
public class wrapper : CBOM.IParameter
{
public wrapper()
{
//
// TODO: Add constructor logic here
//
}
void IParameter.set_Value(ref object obj)
{
}
void IParameter.let_Value(object obj)
{
}
public int ID
{
get
{
return 0;
}
}
public object Value
{
get
{
return null;
}
set
{
}
}
}
}
---------------------------------------------------------

Can anyone suggest what I am doing wrong in the VB.Net code?

Thank you,
Jozsi
Nov 21 '05 #1
1 2019
"Jozsef Bekes" <bj****@hotmail.com> schrieb:
I need to derive a class in VB.Net from a COM interface declared in an idl
file in a VC++ project. Here is the interface declaration:


For the case that you don't get an answer here, consider posting your
question to the Interop group (microsoft.public.dotnet.framework.interop).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Steven T. Hatton | last post by:
This may be another question having an obvious answer, but I'm not seeing it. I'm trying to create a class that derives from std::valarray<std::string>. I don't need a template, and I haven't come...
8
by: JustSomeGuy | last post by:
I need to write an new class derived from the list class. This class stores data in the list to the disk if an object that is added to the list is over 1K in size. What methods of the std stl...
23
by: Eric | last post by:
I've got a fairly simple setup that I thought would work, but I am getting link errors. template <class T> class TType { public: TType( void ) {} virtual ~TType( void ) {}
3
by: craigkenisston | last post by:
Hi, I have a class with 3 constructors, one takes no arguments, other take an string and other an xml document. I want to derive another class of it, I don't need a different constructor so I...
3
by: Miro | last post by:
First off...thanks in advance for getting me this far. Sorry for all these class posts but im having a heck of a time here trying to get something to work, and have finally got it to work (...
15
by: Nindi73 | last post by:
HI If I define the class DoubleMap such that struct DoubleMap : public std::map<std::string, double>{}; Is there any overhead in calling std::map member functions ? Moreover are STL...
6
by: Dan Smithers | last post by:
I want to write my own class derived from the ostream class. I have been getting errors with my templates: First, I get an error writing a nested template. If I leave the function definition...
2
by: Nick Keighley | last post by:
Hi, I'm trying to derive my own exceptions from runtime_error. I want the what() to produce something like runtime error: my error subtype A So I tried: class MyError: public...
3
by: Al Grant | last post by:
Consider two translation units, (1): namespace { struct S { }; } struct D: S { virtual int f(void); }; and (2): #include <typeinfo> struct D; char const *f(D *p) { return...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.