Dynamically invokes a method on the test object. Returns null for methods with the return type void.
Invoke can dynamically invoke all public methods that the MSDN defines for the test object. For test objects in a Windows Forms application or a WPF application, Invoke can additionally invoke all public static methods that the MSDN defines and all user-defined public static methods of any type.
TestObject.Invoke(methodName, [parameters])
TestObject.Invoke(methodName, [parameters])
For an object of the type DataGrid, you can call all methods that the MSDN defines for the type System.Windows.Forms.DataGrid.
//VB .NET code Dim result as Integer = mainWindow.Invoke("System.String.Compare", "a", "b")
//C# code int result = (int) mainWindow.Invoke("System.String.Compare", "a", "b");
The object mainWindow only identifies the application inside which the method is called and can be replaced by any other object in the application.