我在将C#转换为vb.net时遇到问题,但是AddHandler对我不起作用。有人可以帮忙吗?

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


VB.net代码:不起作用

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


AddHandler示例,但不起作用

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


BC32008的错误消息:委托

'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

最佳答案

使用具体对象而不是类:

AddHandler Me.ucSurveyWebControl.OnResponseRecieved, AddressOf ucSurveyWebControl_OnResponseRecieved

10-08 12:08