Question How to call method by name on another object?

sbw87

New member
Joined
Apr 3, 2009
Messages
1
Programming Experience
Beginner
Hi there,
may I just ask a seemingly simple question for which I can't find any solution throughout all the VB.NET documentation: I have to call a (non-static) method of another object (instance!) based upon the name of the method (given as a string).

Thanks a lot for your help
S.
 
Use either a hardcoded select statement, or Reflection. Example of latter:
VB.NET:
objInst.GetType.GetMethod("method").Invoke(objInst, Nothing)
 
Back
Top