473,509 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

delegate problem in translate from c#

I have problem with translate next code from c# to vb :
private UStateEventHandler _myUStateEventHandler;

//where UStateEventHandler is defined as :
//public sealed delegate UStateEventHandler : System.MulticastDelegate
// Create the event handlers we need.
_myUStateEventHandler = _obj1.CreateEventHandler(new
UStateEventHandler(OnUserStateChange));

// Add the event handlers to the session-global events.
obj1.UStateChanged += _myUStateEventHandler;

//where UStateChanged defined in class library as:
//public abstract new event UStateEventHandler UStateChanged

How I can translate to vb +- ?
Thanks
Jun 27 '08 #1
2 873
Hi,

Have a look where the instanced class that is about this
_myUStateEventHandler

Then declare it globaly "WithEvents" (this does not exist in C#)

Then put at the end of the method that is handled handles.blabla

Probably the most simple

Cor

<is******@hotmail.comschreef in bericht
news:b0**********************************@j22g2000 hsf.googlegroups.com...
>I have problem with translate next code from c# to vb :
private UStateEventHandler _myUStateEventHandler;

//where UStateEventHandler is defined as :
//public sealed delegate UStateEventHandler : System.MulticastDelegate
// Create the event handlers we need.
_myUStateEventHandler = _obj1.CreateEventHandler(new
UStateEventHandler(OnUserStateChange));

// Add the event handlers to the session-global events.
obj1.UStateChanged += _myUStateEventHandler;

//where UStateChanged defined in class library as:
//public abstract new event UStateEventHandler UStateChanged

How I can translate to vb +- ?
Thanks
Jun 27 '08 #2
Event handlers can be wired dynamically via 'AddHandler' in VB.
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
Java to VB & C#
Instant C#: convert VB to C#
Instant VB: convert C# to VB
Instant C++: VB, C#, or Java to C++/CLI
"is******@hotmail.com" wrote:
I have problem with translate next code from c# to vb :
private UStateEventHandler _myUStateEventHandler;

//where UStateEventHandler is defined as :
//public sealed delegate UStateEventHandler : System.MulticastDelegate
// Create the event handlers we need.
_myUStateEventHandler = _obj1.CreateEventHandler(new
UStateEventHandler(OnUserStateChange));

// Add the event handlers to the session-global events.
obj1.UStateChanged += _myUStateEventHandler;

//where UStateChanged defined in class library as:
//public abstract new event UStateEventHandler UStateChanged

How I can translate to vb +- ?
Thanks
Jun 27 '08 #3

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

Similar topics

3
2599
by: Minh Khoa | last post by:
Please give me more information about delegate and its usage? Why do i use it and when?
4
1995
by: ^MisterJingo^ | last post by:
Hi all, I've been trying to get my head around delegates. The book i'm using had a single example, not much explaination, and didn't show how to set up a delegate and pass variables in and out...
7
1768
by: Ant | last post by:
Hello, Very simple question but one I need clarified. Which part of the statement below is considered the 'delegate'? Is it the 'new System.EventHandler' or the btnAccept_Click? or is it...
1
1805
by: Quimbly | last post by:
I'm having some problems comparing delegates. In all sample projects I create, I can't get the problem to occur, but there is definitely a problem with my production code. I can't give all the...
9
3086
bvdet
by: bvdet | last post by:
I have done some more work on a simple class I wrote to calculate a global coordinate in 3D given a local coordinate: ## Basis3D.py Version 1.02 (module macrolib.Basis3D) ## Copyright (c) 2006...
11
2332
by: matsi.inc | last post by:
I am looking to make something like a delegate that i can use in my projects but am having a hard time getting started. The behavior I am most interested in is how a delegate changes it's Invoke...
0
850
by: Gezan | last post by:
Hi all, I have a question. The struct below is used to handle the callback of a Unmannaged c++ dll. struct CALLBACK { typedef BOOL (*CALL_AP) (LPVOID pThis, GT_HANDLE hFrom, GT_ERROR...
26
3591
by: raylopez99 | last post by:
Here is a good example that shows generic delegate types. Read this through and you'll have an excellent understanding of how to use these types. You might say that the combination of the generic...
10
2094
by: vcquestions | last post by:
Hi. Is there way to have a function pointer to a delegate in c++/cli that would allow me to pass delegates with the same signatures as parameters to a method? I'm working with managed code. ...
0
7412
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...
1
7069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5060
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...
0
4730
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3216
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
441
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.