473,396 Members | 2,030 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,396 software developers and data experts.

Implementing VB WithEvents in C#

Hi,
I'm trying to use a COM component in a C#.NET project. The sample VB
code of the COM component declares it as so,

Public WithEvents APC As ENTAPCDLL

I've made a reference to the com object in C# project, I want to set the
value of
an object called InputData which is a member of ENTAPCDLL - here's an
extract
from the object browser

public abstract new object InputData [ get, set ]
Member of ENTAPC._ENTAPCDLL

How can I set the value of InputData in C#?
If I create an instance of the ENTAPCDLL class and then do something
like

ENTAPCObject.InputData = new object();

I get " Property, indexer, or event 'InputData' is not supported by the
language; try directly calling accessor methods
'ENTAPC.ENTAPCDLLClass.get_InputData()' or
'ENTAPC.ENTAPCDLLClass.set_InputData(ref object)'"

Any help appreciated.

Joe

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
1 2007
Try calling:

object 0 =new object();
ENTAPCObject.set_InputData(ref o)'
this is one of those little quirks of COM Interop - generated wrappers in C#.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"booksnore" wrote:
Hi,
I'm trying to use a COM component in a C#.NET project. The sample VB
code of the COM component declares it as so,

Public WithEvents APC As ENTAPCDLL

I've made a reference to the com object in C# project, I want to set the
value of
an object called InputData which is a member of ENTAPCDLL - here's an
extract
from the object browser

public abstract new object InputData [ get, set ]
Member of ENTAPC._ENTAPCDLL

How can I set the value of InputData in C#?
If I create an instance of the ENTAPCDLL class and then do something
like

ENTAPCObject.InputData = new object();

I get " Property, indexer, or event 'InputData' is not supported by the
language; try directly calling accessor methods
'ENTAPC.ENTAPCDLLClass.get_InputData()' or
'ENTAPC.ENTAPCDLLClass.set_InputData(ref object)'"

Any help appreciated.

Joe

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #2

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

Similar topics

7
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As...
5
by: Bradley Grant | last post by:
I am trying to write a program to access a device through USB port, there is some Visual Basic program examples that work with the device, but I am trying to write a program using C#, no luck yet,...
0
by: Steve | last post by:
Hello, I have been experimenting/learning to use aspx with and without VS2003. In VS 2003 I created a simple webform/application which contains a listbox and a label. I populate the listbox...
4
by: Shapper | last post by:
Hello, I have an aspx.vb page with this code: Public Class WebForm1 Inherits System.Web.UI.Page Protected WithEvents Menu1 As MenuControl.Web.UI.Menu ... If I have my code in the aspx...
6
by: | last post by:
Is there any additional overhead for declaring a variable using the WithEvents keyword even if none of the events are being handled?
8
by: Bob Day | last post by:
Using VS 2003, VB.NET, MSDE If an event is raised in a class that was NOT instantiated with the WithEvents key word, is that event effectively ignored? Or, another way to phrase the question,...
8
by: DareDevil | last post by:
Class MyClas Friend ReadOnly WithEvents MyObject as AnotherClas .. End Clas I have a VB.NET class that has a readonly object (i.e. It can only be assigned in the constructor). This enables me...
0
by: ZA_AJR | last post by:
Hi All I have a class (aClass, derived from aBaseClass) with implements an interface IMyInterface. aClass also has a private member of type aNotherClass which raises various events. I would like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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.