2 Replies - 307 Views - Last Post: 13 March 2014 - 06:42 AM Rate Topic: -----

#1 mattcash83  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 23-June 12

VFP9 send function name as parameter

Posted 08 January 2014 - 03:40 PM

I am an upcoming programmer as it is, let alone the fact that I am new to the old language. I want to store the name of a function as a string and pass it as a variable to be called upon in a different function.

Function FUNCTION1
   &&blah
ENDFUNC

************************************************************8

Function FUNCTION2
Parameters doit

 &&DO doit

ENDFUNC

***************************************************************

&&Then I want to be able to do:

todo = "FUNCTION1"

=FUNCTION2(todo)




Is this possible, and if so, what is the correct way to do it. Also, this is overly simplified example. Please dont ask me why I want to do this in the first place.

Thanks for any help!!

This post has been edited by mattcash83: 08 January 2014 - 03:43 PM


Is This A Good Question/Topic? 0
  • +

Replies To: VFP9 send function name as parameter

#2 mattcash83  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 23-June 12

Re: VFP9 send function name as parameter

Posted 08 January 2014 - 07:20 PM

I suppose I could do a bunch oh case structurs....

In FUNCTION2:

DO CASE

CASE doit = "FUNCTION1"
=FUNCTION1 ()

etc...

ENDDO

But I would have a lot of these to go through, was hoping there was something in this language set up for this.
Was This Post Helpful? 0
  • +
  • -

#3 mattcash83  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 23-June 12

Re: VFP9 send function name as parameter

Posted 13 March 2014 - 06:42 AM

Dream in Code is obviously NOT the place to go for VFP questions.

To answer my own question:

Function FUNCTION1

   &&blah
   todo = "FUNCTION1()"
   =FUNCTION2(todo)

ENDFUNC
************************************************************
Function FUNCTION2
Parameters doit

 &doit

ENDFUNC


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1