我有以下vb.net代码,试图修复:
Public Delegate Sub RequestHandler(ByVal sender As Object, ByVal e As ManageEventArgs)
Public Custom Event RequestEvent As RequestHandler
AddHandler(value As RequestHandler)
End AddHandler
RemoveHandler(value As RequestHandler)
End RemoveHandler
RaiseEvent(sender As Object, e As ManageEventArgs)
End RaiseEvent
End Event
Public Function Request(ByVal bizID As String, ByVal Optional table As Hashtable = Nothing) As ArrayList
Me.aList = New ArrayList
If (Not Me.RequestEvent Is Nothing) Then
Dim e As New ManageEventArgs(bizID, table)
Me.RequestEvent.Invoke(Me, e)
End If
Return Me.aList
End Function
我有以下错误:
Error BC32022 'Public Event RequestEvent As Manage.RequestHandler' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
vb.net并不是我首选的语言,因此任何帮助都将不胜感激
更简单的方法:
Public Event RequestEvent(sender As Object, e As ManageEventArgs)
,然后:
Public Function Request(bizID As String, Optional table As Hashtable = Nothing) As ArrayList
Dim aList As New ArrayList
RaiseEvent RequestEvent(Me, New ManageEventArgs(bizID, table))
Return aList
End Function
我不确定您的Alist Thicky是怎么回事。