Link to home
Start Free TrialLog in
Avatar of milani_lucie
milani_lucieFlag for United States of America

asked on

VB.NET equivalent code is needed ...

Hi,

I have following C# code for WCF. Can you please convert this C# code into VB.NET code ?

Service1Client svc = new Service1Client();
svc.GetPersonsCompleted += new EventHandler<GetPersonsCompletedEventArgs>(svc_GetPersonsCompleted);

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dim svc As New Service1Client()
svc.GetPersonsCompleted += New EventHandler(Of GetPersonsCompletedEventArgs)(svc_GetPersonsCompleted)
Avatar of milani_lucie

ASKER

Both of them are not working ....

svc.GetPersonsCompleted += New EventHandler(Of GetPersonsCompletedEventArgs)(svc_GetPersonsCompleted)  // Syntax Error

Thanks
Try

AddHandler svc.GetPersonsCompleted, AddressOf (Of GetPersonsCompletedEventArgs)(svc_GetPersonsCompleted)
AddHandler svc.GetPersonsCompleted, AddressOf (Of GetPersonsCompletedEventArgs)(svc_GetPersonsCompleted)

Good try ... but NO LUCK !!

Thanks
ok, it is time to ask,

What are you trying to acomplish??

Is this a wcf service???
Yes..I want to do Asynchronous Communication - Event Based Model using VB.NET.

Thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Masteraco:

I am using Event Based Model.

Thanks
Nope...

http://msdn.microsoft.com/en-us/library/ms730059.aspx

This does not work ....

Thanks
>Both of them are not working ....

You are getting errors? Nothing happening?
Them are not apps are examples and tutos  of how to do it
I have gone through this article already - http://www.codeproject.com/Articles/31077/Automatic-Implementation-of-the-Event-Based-Asynch . But i did not understand why the MSDN itself is NOT working - http://msdn.microsoft.com/en-us/library/ms730059.aspx

Thanks
Are you working with Framework 4 right?
CodeCruiser,

Nothing is happening. I am not getting any results back from server. No error though.

Thanks
Framework 3.5 - Visual Studio 2008

Thanks
So it may not be the code issue on client. May be the call to the service is not executing or some other issue. That is the syntax in VB.NET for the code you showed though.
Sorry. It is not giving results in C# also. The article i have followed is not a good article. Appreciate your great help !!

Thanks