Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can anyone help me to convert this to vb.net?

XML
public event EventHandler<AppointmentEditEventArgs> AppointmentEdit;
 protected void FireAppointmentEdit(Appointment appointment)
        {
                EventHandler<AppointmentEditEventArgs> handler = AppointmentEdit;
                if (handler != null)
                {
                    AppointmentEditEventArgs args = new AppointmentEditEventArgs(appointment,this);
                    handler(this, args);
                }

        }


I tried few online conversion tools but getting an error "Public Event AppointmentEdit(Sender as Object, e as Events.AppointmentEditEventArgs) is an event, and cannot be called directly. use a RaiseEvent statement to raise an event. Below the vb.net online converted version.

VB
Public Event AppointmentEdit As EventHandler(Of AppointmentEditEventArgs)
Protected Sub FireAppointmentEdit(appointment As Appointment)
    Dim handler As EventHandler(Of AppointmentEditEventArgs) = AppointmentEdit
    If handler IsNot Nothing Then
        Dim args As New AppointmentEditEventArgs(appointment, Me)
        handler(Me, args)
    End If

End Sub
Posted
Updated 6-Oct-15 21:03pm
v2
Comments
jaket-cp 7-Oct-15 5:14am    
You could try a dotnet decompiler of some sort.
With a little googling - check out this link it may help:
http://stackoverflow.com/questions/2646707/something-better-than-net-reflector

Hi,

Check this...
http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]

Hope this will help you.

Cheers
 
Share this answer
 
Comments
Albin9 7-Oct-15 3:41am    
This conversion is not working, always shows "Thanks! We're now processing your upload"
And that should teach you two things:
1. All those online (offline too) code converters are brainless and can't know from the code itself that a function call is function call or handler call (there is no syntax difference in C#)
2. Never go for VB...

What you have to do is to understand the error and fix the syntax errors for yourself (an automatic conversion can take you that far only)...

RaiseEvent for VB[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900