** (1) Open VFP9 ** (2) Run the following code: *------------------------------------------------- * VFP9 Controlsource-Bug: PUBLIC goForm goForm = CREATEOBJECT("myForm") goForm.Show() DEFINE CLASS myForm As Form ADD OBJECT Grid1 As Grid PROCEDURE Load() Create Cursor curTest(iPeriod I) Insert Into curTest Values(200411) Insert Into curTest Values(200412) Insert Into curTest Values(200501) Go Top ENDPROC PROCEDURE Init() WITH Thisform.Grid1 .Recordsource = "curTest" .ColumnCount = 1 .Columns(1).Controlsource="cMonthOfPeriod(curTest.iPeriod)" * alternatively use the following Controlsources to get different contradictory behaviour: * .Columns(1).Controlsource="=cMonthOfPeriod(curTest.iPeriod)" * => why "... must be a variable reference"? * .Columns(1).Controlsource="cMonthOfPeriod(uDoNothing(curTest.iPeriod))" * => why "variable not found"? * .Columns(1).Controlsource="cMonthOfPeriod(Transform(curTest.iPeriod))" * => error in cMonthofPeriod as expected, as the parameter type is wrong, * but the controlsource is accepted! * .Columns(1).Controlsource="uDoNothing(cMonthOfPeriod(curTest.iPeriod))" * => Works!? Why not the other way around then??? ENDWITH ENDPROC ENDDEFINE FUNCTION cMonthOfPeriod() LPARAMETERS tiPeriod RETURN CMONTH(DATE(1900,VAL(RIGHT(STR(m.tiPeriod),2)),1)) ENDFUNC FUNCTION uDoNothing() LPARAMETERS tuAnything RETURN tuAnything ENDFUNC *-------------------------------------------------Bye, Olaf.