The way I do this is:
1) Make the form MODAL.
2) Create a property in the form to hold the return value (cRetVal)
3) In the OK or Close button of the form, put the return value into the property, then Hide (not Release) the form.
4) Use this code to launch the form and get the value:
loForm = createobject("_myform")
loForm.Show()
myRetValVariable = loForm.cRetVal
loForm.Release()
Now myRetValVariable has your return value.
>VFP 6.0 SP 3
>
>I have a form in a class that I would like to return a value. But I can't figure out how I can do it. I have "return myretvalue" in the unload method of form but I don't know how to grab that value from the calling program. Here what I have so far:
>
>set classlib to myclass
>loForm = createobject("_myform")
>loForm.visible = .t.
>
>This shows the form but does not allow me to get the return value. The value ranges from 0 - 3 depending on user actions.
>
>Thanks,
>Randy