You can also use BindEvent (which is what I do --- I'm one of those who adds columns to my grids at runtime)
>>Summary: In order to create a more flexible grid, some developers choose to build the grid's columns and controls at run-time. But since you can't add code to events and methods at run-time, you've got a bit of a dilemma.
>
>You can "add" code at run-time in a method or an event. Have the event execute an external procedure -- call it in the method or event code. In the event or method that you want to have code defined at run-time, enter the following:
>
>
>DO GetExternalUserExit WITH 'ExternalUserExit001"
>
>
>Now define an UDF that is named GetExternalUserExit.prg with the following code:
>
>
>FUNCTION GetExternalUserExit
>LPARAMETERS pcExternalUserExit
>SELECT codetable
>LOCATE FOR funcname = pcExternalUserExit
>IF FOUND()
> STRTOFILE(ALLTRIM(codetable.code),pcExternalUserExit+".prg")
> DO (pcExternalUserExit)
>ELSE
> WAIT WINDOW "ERROR -- UDF Not defined"
>ENDIF
>
>
>Then create a table that has the following two columns:
>
> Field Name Type
> -------------------------------
> FuncName C(40)
> Code Memo
>
>Then add the value "ExternalUserExit001" to the codetable.funcname field and the following code to the codetable.code field:
>
>
>FUNCTION ExternalUserExit001
>WAIT WINDOW "My Runtime User Exit"
>ENDFUNC
>
Jim Nelson
Newbury Park, CA