PARAMETERS(), the FoxPro version, tells you how many parameters were passed in the last function or procedure call. PCOUNT(), supposedly added only for dBASE compatibility and not even listed in the Help index before VFP 5, tells you how many parameters were passed to the routine you're now in. This time, we think dBASE got it right. Using PARAMETERS() has always been a tricky thing. You have to be sure to grab the value as soon as you enter the routine and hope that no ON KEY LABEL or other interrupt occurs that could change the value before you get it. PCOUNT(), on the other hand, gets that part right every time. We recommend you stick with PCOUNT() and avoid PARAMETERS().Sounds like PARAMETERS() has its problems. I have always used PCOUNT() for no special reason. Maybe my brain always thought PCOUNT() was less chars to type :)
DEFINE CLASS Foo AS CUSTOM OLEPUBLIC >> cResult = "" >> >> PROCEDURE FooMethod(cFoo) >> >> IF PARAMETERS() < 1 >> This.cResult = "No Parameters passed" >> ELSE >> This.cResult = "Parameters passed - " + TRANSFORM(PCOUNT()) >> ENDIF >> ENDPROC >>ENDDEFINE