Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem when using EXECSCRIPT()
Message
From
17/10/2005 10:16:34
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
17/10/2005 06:12:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01059568
Message ID:
01059597
Views:
11
>HI ,
>
>Help me Please .
>
>I use 'Execscript' to run a code which is stored in a table . But an error appeared :'THISFORM can only be used within a method'
>
>with a macro substitution there's no problem . But I want to use 'Execscript'

Macro executes as part of the code in the method - as if it was written within it. ExecScript(), however, is a piece of code called, it's basically a little .prg compiled on-the-fly, so its context is not that of a method.

To add to the techniques mentioned by others in this thread, here's the way I do this: you can have your script accept a parameter. Just add a "lparameter oThisform" to your script, and replace all of "thisform" with "oThisForm" in your script. And since the script is just a string, you don't really need to go into all of the code snippets in your table, you can just do it while calling:
cScript=yourtable.scriptmemo
cScript=strtran(cScript, "thisform","othisform")  && set the case insensitive flag here
cScript="lparameters oThisform"+chr(13)+cScript
execscript(cScript, thisform)

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform