Results 1 to 3 of 3

Thread: Evaluating Items from a File

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    4

    Post

    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.


  2. #2
    Addicted Member
    Join Date
    Nov 1999
    Location
    Lost
    Posts
    216

    Post

    Try using: "select case" on the string
    then
    case : "....."
    case: "......"
    ;
    ;

    if any problem mail me:
    MYR@cyberia.net.lb
    Mimo

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    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
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com
    ICQ#: 51055819


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width