S
schneider
I'm looking for a way to programaticly call a method from a different object
and associate the two objects at runtime.
Example: Object A exist and is unknow, I want object B to be able to call a
method on object A whenever needed.
Like addhandler but I don't know what the method is and must discover it
through reflection.
Maybe something like this:
Public Sub attach(ByVal valueA As Object)
Dim meth() As MethodInfo = value.GetType.GetMethods
Dim btnB As Button = New Button
Dim mitem As MethodInfo = meth(0) 'find the method I want somehow
AddHandler btnB.Click, mitem.[Selected_Method] '???
End Sub
Any ideas would be great.
Thanks,
Schneider
and associate the two objects at runtime.
Example: Object A exist and is unknow, I want object B to be able to call a
method on object A whenever needed.
Like addhandler but I don't know what the method is and must discover it
through reflection.
Maybe something like this:
Public Sub attach(ByVal valueA As Object)
Dim meth() As MethodInfo = value.GetType.GetMethods
Dim btnB As Button = New Button
Dim mitem As MethodInfo = meth(0) 'find the method I want somehow
AddHandler btnB.Click, mitem.[Selected_Method] '???
End Sub
Any ideas would be great.
Thanks,
Schneider