>I usually create forms using the form designer, and run them with the DO FORM command. So, I am familiar with passing arguments into the form via that command, and obtaining results from the form:
>
>When I use the DO FORM command, the form returns its result from the Unload method: "RETURN thisform.Result"
>
>However, I have recently created a form class that I want to instantiate and run via CreateObject(). I know that I can pass parameters into the form in the arguments in the call to CreateObject(). But, how do I get a result back from the form?
I create an object that I pass to the form. The form stores the object to a custom property in the Init() event. Then I can access as I need to the values on the object.
loReturn = CREATEOBJECT("Empty")
ADDPROPERTY(loReturn,"Value1","")
ADDPROPERTY(loReturn,"Array1[3,2]","")
loAbout = NEWOBJECT("About","about.vcx",0,loReturn)
loAbout.Show(2)
The above would create the About form and pass loReturn object as a parameter. I store the object to a custom property in the Init() method:
LPARAMETERS poReturn
thisform.oReturn = poReturn
Now I can reference anywhere in the form the object and set the values:
thisform.oReturn.Value1 = "Some return value"
Also, you can pass arrays this way too.