Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute Code From edit box at runtime

Status
Not open for further replies.

Brenton

Technical User
Jul 29, 2002
43
US
I have an edit box that I am trying to put code in at runtime. I am running into the following.

edit1.middlclick event
Public EditStr
EditStr = this.value

edit1.middleClick event
strtofile(EditStr, "c:\program.prg"
this.value = EditStr
do c:\program.prg <-- this is where I get errors. *unrecognized command verb.*

Also if I have a chr(13) in my edit box it won't write the chr(13) to the file.

Any help is appreciated.

Brenton Pryer
 
Brenton,
What version and SP of VFP are you using? Are you trying to &quot;run&quot; this in the VFP IDE, or strictly with the VFP Runtimes?

Rick
 
I am useing VFP 7 and I am using this in runtime only.

 
Brenton,
You can't compile code in the runtime environment until VFP 8.0. The following is from the VFP 8.0 Help File:
In Visual FoxPro, you can compile Visual FoxPro source into run-time files created with either vfp8r.dll or vfp8t.dll. In prior versions of Visual FoxPro, you had to use macro substitution or expression evaluation for each line in order to execute code generated at run time. This process was not always optimal because of the complexities of executing large blocks of code and the performance penalty incurred using the macro operator &, or the EVALUATE( ) function.


Rick


 
well crap!! Thanks for the help though.

 
You can run code at runtime with VFP 7 using execscript() and bypass the prg route enitrely, or you can issue a COMPILE MyPrg command before DOing it.

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top