Link to home
Start Free TrialLog in
Avatar of wseaward
wseaward

asked on

Dynamically choosing parameters for running objects.

I'm building a DLL Tester program that will test the various DLL's that we created. I have two dropdowns, one for the DLL name and class assoicated with it and the other for the method that we want to utilize. After choosing these, a grid is populated with the parameters that this method uses. My question is: After I create the object and want to run this method, how would I code this? For example, assuming "obj" is the object and I want to use the method "send" and it takes two parameters, first one is of type"Long" and the second one is of type "Boolean". In normal vb code it would be obj.send 123456, True... So, how could I write this dynamically?
Avatar of JR2003
JR2003

Are they VB ActiveX dlls you are testing?
Do you have a reference to the dlls in your project references?
Are the dll names, class names and method names hard coded in the application or generated at runtime?
Avatar of wseaward

ASKER

The dll name, class, methods, and parameters are feed from a database. For example: a table contains the names of the dlls and all the classes that it contains. Another table contains all the methods with its parameters. Via these two tables, I populate the two dropdowns and depending on which I've chosen, this would populate the grid which shows the parameters. These dlls are NOT in the project reference, but these would be installed on my computer (or in a vb project if you want to watch the code execute). I've tried to concatenate the command together and it bombs miserably and this is where my problem is. I can create the object from the first dropdown, for example:

cboDLL would be the dll name and class

Set obj = CreateObject(cboDLL)

This works just fine... the problems comes with the next step, taking the values from the grid and dynamically issueing the "send" method while making sure that the parameter have the right value.

obj.send 123456, True

I tried to concatenate this together, but this didn't work at all... How can I go about getting this command together, bringing in the ".send" from a dropdown, and the two parameters from the grid. Now the grid has "type" in one field and the "value" in another field.
ASKER CERTIFIED SOLUTION
Avatar of JR2003
JR2003

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
PS: Another way to do it is to use VB's CallByName function.