1
我只是有一個關於將一個目標方法作爲變量參數添加到我的調用方法的簡短問題。使用方法參數來路由我的事件
我想發送一個TextChanged
事件到一個特殊的文本框。但我想在我的方法中添加一個「變量」來將處理程序添加到文本框中。因爲可以更改文本框,然後我可以更改「更改事件」應該路由到的處理程序。
我應該用???
Dim TextBox1 as TextBox
Dim TextBox2 as TextBox
Private Sub DoIt
Call TestRouting(TextBox1, TextBox_TextChanged)'I want to submit the methode where the changed event should route to
End Sub
Private Sub TestRouting(byval Obj as TextBox, byval ChangedAction as ???)
Addhandler Obj.TextChanged, AddessOf ChangedAction
End sub
Private sub TextBox_TextChanged(byval sender as object, byval e as args)
'do something
End Sub
當'TextBox1_TextChanged'被其中一個動作的ARGUMENT調用時,我想調用'act1'或'act2'或'act3'。在參數'e As Action'中應該是'act?'之一,然後我可以調用'actX'的方法,它除了方法描述外沒有任何接口。 – Nasenbaer