oForm = createobject('myForm') oForm.Show Read events Define class myForm as Form MyProperty = 0 && This is what you previously used as global Add object text1 as textbox Add object command1 as commandbutton with Top = 50 Procedure init If !'MYPROCSTORE.PRG'$set('PROCEDURE') && Function is in MYPROCSTORE.PRG Set procedure to myprocstore additive Endif Endproc Procedure GetResult && A custom method Thisform.text1.value = myFunction(thisform.MyProperty) Endproc Procedure queryunload Clear events Endproc Procedure command1.click Thisform.MyProperty = 25 && Any method in form might have set this Thisform.GetResult() && Do rest via custom form method Endproc Enddefine
*myprocstore.prg function MultiplyBy5 lparameters tnValue return tnValue*5 function myFunction lparameters tnValue local lcRetVal do case case tnValue % 2 = 0 return 'Even' case tnValue < 25 return 'A small number' case tnValue > 2000 return 'W2K rocks' otherwise return "I don't know what to say" endcaseActually I would suggest using custom objects for frequently used methods by many other objects like a form. Now for the moment just try if this helps.