Using string to specify method to call on object 
Author Message
 Using string to specify method to call on object

Hi,

I'm creating an .ini file driven automation application, and I need to be
able to specify the method that gets called on an object with a text string
read in from the file.

At the moment I'm just using a big select case statement, but there must be
a better way to do this...

Any hints?

Thanks,
Michael



Mon, 27 Dec 2004 02:34:27 GMT  
 Using string to specify method to call on object
Yes, there is a better answer - its called reflection. Using it you can call
the method by passing in the name as a string. For more information look at
ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpcondynamicallyloadingusingtypes.h
tm

Sam & Matt
VB Team

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> Hi,

> I'm creating an .ini file driven automation application, and I need to be
> able to specify the method that gets called on an object with a text
string
> read in from the file.

> At the moment I'm just using a big select case statement, but there must
be
> a better way to do this...

> Any hints?

> Thanks,
> Michael



Tue, 28 Dec 2004 03:14:11 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using an object that has a method called New

2. (Check this out) Calling Stored Procedures from Connection object WITHOUT using Exectue method

3. Calling a COM call back object's method fails if it is in Windows 98

4. String values in the place of specifying the actual object

5. Using data to specify forms/functions to open/call

6. Crystal Reports ANd VB 6.0 Printing reports using CRPEAUTO Object, specifying paper orientation problem

7. OLE automation - calling method function with string par by reference

8. Calling method which name is in a string

9. Calling Class Method / Property with String Variable

10. How to call a method which is in a string

11. Diference between function an method in String object

12. Quit method call to a Word object returns ambiguous Error in VB.Net

 

 
Powered by phpBB® Forum Software