>>I just wanted to share some code from an idea I implemented to create and easy way to programmatically bind columns in my grids to a cursor, with a few other cool tricks too, like calculated fields and Casting to control decimal formats.
>>
>>See what you think...
http://therealmattslay.blogspot.com/2009/12/grid-column-databinding-feature-for-vfp.html>>
>>.
>
>Matt,
>Isn't it easier just to simply assign the recordsource. Columns would be automatically bound in the order they are in cursor.
>Cetin
Well, sometimes my cursor has columns that I do not want to display in the grid (primary keys and foreign keys and other data that I just don't want to show).
Plus, I may also want calculated columns, like (total = qty * price) (rate = laborcost / labor hrs). The columns required to do the calculations are in the cursor, but not the total or rate columns. I could add them to the sql , but who knows if this is good or not, if you do not have access to change SQL query.