>Grid sits on a page on a pageframe. Clicking on the page loads the grid. Everything works except that I want to specify a different control and controlsource for the 2nd column:
>
>*Page Activate:
> loObject = THIS.Grid1.Column2
> THIS.Grid1.RECORDSOURCE=""
> THIS.Grid1.RECORDSOURCE="Tracy"
> IF !PEMSTATUS(loObject,'Edit1',5)
> WITH THIS.Grid1.Column2
> .REMOVEOBJECT([Text1])
> .ADDOBJECT([Edit1],[EditBox])
> .CURRENTCONTROL = [Edit1]
> .Edit1.CONTROLSOURCE = "(thisform.returntheaddress())"
> .Edit1.VISIBLE = .T.
> ENDWITH
> ENDIF
>*Form returntheaddress method (field names are correct and all are character):
> RETURN (ALLTRIM(number) + IIF(!EMPTY(apt_room),"-" + TRIM(apt_room),' '))
>*This fails as well:
> RETURN "Test Value"
>
>When the pagetab is clicked, the following error appears:
>
Parent object will not allow this property setting for form1.pageframe1.page1.grid1.column2.controlsource.Try controlsource for the column, not EditBox. Also I'm a little bit surprised of using PEMSTATUS for checking object. I would probably use type or getpem here. Also I would add alias in ReturnAddress method. But if this method so simple, would it be easier to use this directly instead of a method? I also don't think you need to put it in parens.
If it's not broken, fix it until it is.
My Blog