Hi Everybody,
I am creating a C# based DLL that exposes methods to perform actions and verifications on QTP test objects. So far I was able to successfully develop code for some of the QTP web objects (such as WebEdit, WebList etc..) but having problems in implementing method that operates on WebTable.
Here is my code:
public void WebTable(object testObject, string val)
//WebTBLType = Type.GetTypeFromProgID("Mercury.WebTable.2");
// TblObj = Activator.CreateInstance(TBType);
int rCount = (int)testObject.GetType().InvokeMember("RowCount", System.Reflection.BindingFlags.InvokeMethod, null, testObject, null);
int cCount = (int)testObject.GetType().InvokeMember("ColCount", System.Reflection.BindingFlags.InvokeMethod, null, testObject, null);
for (int i = 0; i < rCount - 1; i++)
for (int j = 0; j < cCount; j++)
object TBLCellObj = testObject.GetType().InvokeMember("ChildItem", System.Reflection.BindingFlags.InvokeMethod, null, testObject, new object[] { i,j,"Link",0 });
if ((string)TBLCellObj.GetType().InvokeMember("GetROP roperty", System.Reflection.BindingFlags.InvokeMethod, null, TBLCellObj, new object[] { "innertext" }) == val)
TBLCellObj.GetType().InvokeMember("Click", System.Reflection.BindingFlags.InvokeMethod, null, TBLCellObj, null);


What I am expecting this code to do is: accept a test object of type WebTable and a value of type string from QTP, and then search the webtable for a link whose inner text is equalent to the string passed to this method, and then click on it.
When I call this method from QTP, I'm getting below error.
External object <namespace>.<Class Name>::<Method Name> has thrown the following exception:
The statement contains one or more invalid function arguments.

I am guessing the issue might be in the below piece of code:
new object[] { i,j,"Link",0 });
Here I am trying to pass an array of objects of different types.
Can any body tell whether this was the issue that caused the error? If so is there any other way to pass MULTIPLE PARAMETERS OF MULTIPLE TYPES to the Type().Invokemember()?