Vektor
That is not quite what I'm after. Say I had several functions that had the same interface as the delegate. How could I specify the function name as a string variable?
Perhaps if I gave a psudo-code example to explain what I mean:
VB Code:
Private Delegate Sub MyDelete(ByVal showText As String) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim strFunctionName as String Dim oDelegateObject As MyDelete strFunctionName = "MyDelegateCallback" oDelegateObject = New MyDelete(AddressOf strFunctionName) oDelegateObject.Invoke("I am using a delegate!") End Sub Private Sub MyDelegateCallback(ByVal showText As String) MessageBox.Show(showText.Trim()) End Sub
NOTE: I need the function name to be a string variable because I will be getting it from an XML file.





Reply With Quote