-
Let's say I have 2 functions called Function1 and Function2
I then have a file, sample.txt, in which the first 2 lines are as follows:
Function1(arguments)
Function2(arguments)
How would I read this file, in such a way that I could then call the functions from the file.
There would actually be hundreds of functions, so I cannot assign each line from the file to a string and then say
if string = "Function1" Then
Call Function1
if string = "Function2" Then
Call Function2
This would be far too unwieldy for 100's of different functions, which is why I would like to be able to evaluate the lines I'm reading in from the file and activate the functions as they are read in.
-
Try using: "select case" on the string
then
case : "....."
case: "......"
;
;
if any problem mail me:
[email protected]
Mimo
-
If you have VB6 then you can use CallByName function. But you would have to have your functions in a Class Module (not regular mudule) because CallByName function has first parameter as an object.
Syntax: CallByName(object, procname, calltype,[args()])
Example:
iSum = CallByName(Class1, "Multiply", VbMethod, 5, 5)
MsgBox iSum
Assuming that I have function Multiply in calss called Class1.
Regards,
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819