Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Command works in command window but no in method code
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00013089
Message ID:
00013183
Views:
30
>Hi guys,
>I have a problem with this code, it works fine on the
>command window, but when I try to run the same code from
>within a method it reports me an error, the code is something like this:
>cMy_String='m.last_name'
>If I say in the command window this:
>?cMy_function(&cMy_string)
>it works fine, but if I call a method that has this same
>line of code it crash with an error, and it doesn't even let me 'Cancel','Suspend' or 'Ignore', it just show the error and the line with the error, which is the previous one, I am using VFP 3.0, any sugestions ?
>Thanks in advance.
>luisg@netrunner.net


Louis,

First, we should know what cMy_function() is doing. Second, usually, functions return a value to the calling program, but here you are passing cMy_String by reference, not value, so cMyString will not change...ie the value of it. If you want to manipulate the VALUE of cMy_String, pass it by VALUE... cMy_String=cMy_Function(cMy_String) but give the function a place to store the value once it returns to the calling program. We really need more code to see what you are doing to give the appropriate advice. Remember, a procedure or function is both, depending on how they're called, and if you call it as a function, you must DO something with the result.

Hope this helps
Jon
Jon Paskett

Microsoft Certified Systems Engineer
We all have to start somewhere...
Sometimes over again!
Previous
Reply
Map
View

Click here to load this message in the networking platform