Searching for a Solution with "DO &VarName"

This forum is meant for questions about the Visual FoxPro Language support in X#.

Post Reply
User avatar
Florentin Lüdeking
Posts: 11
Joined: Tue Aug 02, 2022 1:42 pm

Searching for a Solution with "DO &VarName"

Post by Florentin Lüdeking »

Hey guys is there a solution for my little problem to start a prg with a variable?

Code: Select all

cExecCode = "programm1"
DO &cExecCode
I also tried evaluate() but it didnt work either.
User avatar
robert
Posts: 4551
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Searching for a Solution with "DO &VarName"

Post by robert »

Florentin,

The compiler rule for DO expects an identifier and not a macro (yet). I will change that for a next build.

You should be able to call it like a function:

Code: Select all

&(cExecCode+"()")
or slightly more advanced, bypassing the macro compiler

Code: Select all

_CallClipFunc(cExecCode)
The last method also allows you to pass parameters like this

Code: Select all

_CallClipFunc(cExecCode,1,"42",Date())
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
robert
Posts: 4551
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Searching for a Solution with "DO &VarName"

Post by robert »

Florentin,
Added as "todo"
https://github.com/X-Sharp/XSharpPublic/issues/1147
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Florentin Lüdeking
Posts: 11
Joined: Tue Aug 02, 2022 1:42 pm

Searching for a Solution with "DO &VarName"

Post by Florentin Lüdeking »

I tried the solution and it works :)

Thank your Robert!
Post Reply