0

I need to convert the following code from C# to VB.NET.

lnkSynEvent.Click += 
         new EventHandler((s,e)=>lnkSynEvent_Click(s, e, your_parameter));

Here lnkSynEvent is the id of button. Any Help is appreciated.

3
  • converter.telerik.com/# Commented Oct 18, 2016 at 12:29
  • @Narek Arzumanyan. I had tried that telerik converter already but when i use that code in visual studio it throws error at compile time Commented Oct 18, 2016 at 12:30
  • @vinunatesh Please share your code Commented Oct 18, 2016 at 12:38

3 Answers 3

3

It can be used like this:

AddHandler lnkSynEvent.Click , Sub(s, ea) lnkSynEvent_Click(s, ea, your_parameter)

Or this:

AddHandler lnkSynEvent.Click , Sub(s, ea)
                                   lnkSynEvent_Click(s, ea, your_parameter)
                               End Sub

Note

  • Pay attention, you should have a lnkSynEvent_Click accepting 3 parameters of consistent types which you are trying to pass to it.

  • Usually you can trust the out put of online code converters, but you should have enough knowledge and know syntax yourself enough to be able to change some part of converted codes.

  • For more description and example take a look at Lambda Expressions (Visual Basic).

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your solution. It Works fine
0
lnkSynEvent.Click += New EventHandler(Function(s, e) lnkSynEvent_Click(s, e, your_parameter))

Comments

0

You get online code converter which can help you to convert C# to VB.

http://converter.telerik.com/

lnkSynEvent.Click += New EventHandler(Function(s, e) lnkSynEvent_Click(s, e, your_parameter))

1 Comment

This isn't an answer to OP, also, if you paste the exact C# line they are wanting converted, the telerik converter returns an error as lnkSynEvent.Click is not implemented and therefore, the converter doesn't know what to do with it. A more helpful answer would be to include what OP could have done to get such a line to convert properly using the provided converter. (ex. replace lnksynevent.click with something else, etc)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.