2

我在将 ac# 转换为 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
4

2 回答 2

5

使用具体对象而不是类:

AddHandler Me.ucSurveyWebControl.OnResponseRecieved, AddressOf ucSurveyWebControl_OnResponseRecieved
于 2013-02-10T16:45:28.620 回答
2

尝试这个 :

AddHandler Me.ucSurveyWebControl.OnResponseRecieved, AddressOf ucSurveyWebControl_OnResponseRecieved
于 2013-02-10T16:45:48.400 回答