2

I am having a issue with a c# to vb.net conversion, but AddHandler is not working for me. Can anyone help?

this.ucSurveyWebControl.OnResponseRecieved += new MentorLogic.Engines.Zodiac.Web.OnResponseRecieved(ucSurveyWebControl_OnResponseRecieved);

VB.net code: does not work

Me.ucSurveyWebControl.OnResponseRecieved += New MentorLogic.Engines.Zodiac.Web.OnResponseRecieved(ucSurveyWebControl_OnResponseRecieved)

AddHandler example but does not work

AddHandler MentorLogic.Engines.Zodiac.Web.OnResponseRecieved, AddressOf ucSurveyWebControl_OnResponseRecieved

error messages for BC32008: Delegate

'MentorLogic.Engines.Zodiac.Web.OnResponseRecieved' requires an 'AddressOf' expression or lambda expression as the only argument to its constructor.

error `BC30676`: 'OnResponseRecieved' is not an event of 'MentorLogic.Engines.Zodiac.Web'. Page Validation Complete
spajce
  • 7,044
  • 5
  • 29
  • 44
John D
  • 79
  • 1
  • 3

2 Answers2

5

Use the concrete object instead of the class:

AddHandler Me.ucSurveyWebControl.OnResponseRecieved, AddressOf ucSurveyWebControl_OnResponseRecieved
Nico Schertler
  • 32,049
  • 4
  • 39
  • 70
2

Try this :

AddHandler Me.ucSurveyWebControl.OnResponseRecieved, AddressOf ucSurveyWebControl_OnResponseRecieved
Abdusalam Ben Haj
  • 5,343
  • 5
  • 31
  • 45