'AddHandler' 和 'RemoveHandler' 方法必須剛好有一個參數
自訂事件宣告必須有 AddHandler
或 RemoveHandler
宣告,每個宣告會接受自訂事件的 As
子句所指定之委派類型的單一參數。
錯誤 ID︰ BC31133
- 從參數清單中移除額外的參數,並將參數類型變更為與自訂事件的
As
子句所指定之委派類型相同的類型。
這個範例示範具有 AddHandler
和 RemoveHandler
宣告之正確參數類型的自訂事件。
Custom Event Test As System.EventHandler
AddHandler(ByVal value As System.EventHandler)
' Code for adding an event handler goes here.
End AddHandler
RemoveHandler(ByVal value As System.EventHandler)
' Code for removing an event handler goes here.
End RemoveHandler
RaiseEvent(ByVal sender As Object, ByVal e As EventArgs)
' Code for raising an event goes here.
End RaiseEvent
End Event