473,397 Members | 1,949 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,397 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 2026
"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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.