InvokeMember-Reflection

enginv

New member
Joined
Apr 29, 2008
Messages
2
Programming Experience
Beginner
Hi,

Partial Class _Default
Inherits System.Web.UI.Page

Private Sub pageLoad(ByVal sender As Object, ByVal args As System.EventArgs) Handles Me.Load

Dim calledType As Type = Type.GetType("_Default")

calledType.InvokeMember("test", BindingFlags.InvokeMethod Or BindingFlags.Public, Nothing, Me, Nothing)

End Sub
Public Sub test()
Response.Write("Success")

End Sub


----------------------------------------------------

I am trying to call a public method using the above way but I could only achieve to call shared methods using flags public and static and nothing as an argument.

Thanks
 
Solved.

Dim calledType As Type = Type.GetType("_Default")

calledType.InvokeMember("test", BindingFlags.InvokeMethod Or BindingFlags.Public Or BindingFlags.Instance, Nothing, Me, Nothing)
 
Back
Top