Hi Ed,
Thanks for the reply. I thought that I had forgot everything...It seems that it only worked when I saved the parameter to a local variable before I create the application object as in the following code:
Main.prg
LPARAMETER lcValue
LOCAL lcUserLevel
IF PARAMETERS() = 1
lcUserLevel = lcValue
ELSE
lcUserLevel = .F.
ENDIF
SET CLASSLIB TO "Framework"
oApp = CREATEOBJECT("App", "Jet Development Framework")
IF lcUserLevel = "PROGRAMMER"
oApp.cUserLevel = lcUserLevel
ENDIF
If I try and read a value from the parameter lcValue after the oApp line it is not there. Don't know why... Thanks for all the replys Cetin, Craig, and Mike and Ed helping me solve this....
>>How do I pass a parameter to my main.prg of an application?
>>
>>I tried putting LPARAMETER... on the first line of the main.prg but it does not receive the parameter passed on the command line
>>
>>C:\myapp.exe myparameter
>>
>
>Remember that an LPARAMETER is a LOCAL variable - it would be visible in your MAIN, but not in anything that MAIN called. If you need to see the parameter in modules other than MAIN, save the parameter in a PRIVATE or PUBLIC variable, or better, save it as a property of an application object that will remain active and in scope for the duration of the application, and then reference whatever you save the parameter received by MAIN.
>
>Alternatively, a PARAMETER (as opposed to an LPARAMETER) scopes the parameter as a private memvar.
>
>Be aware that declaring another variable with the same name in another module will hide or possibly destroy the parameter variable from MAIN. Statements like
PRIVATE ALL LIKE | EXCEPT skeleton will also hide it, without necessarily creating a replacement variable. This was used by lots of people back before the introduction of LOCAL variables in VFP - most of my modules written back in Fox 2.x had a
PRIVATE ALL LIKE j* in them, and I then used variables begiing with J for my junk variables intended to be used only within the procedure or function they were created in.
>
>>
>>Thanks