Friday, December 30, 2011

How, When & Why Grid Reconstructs

I suddenly realized that there are still  VFP developers who are not much aware why a Grid Reconstruction occurs.  Why does it happen?  So I decided to create this entry for them.

We are binding/linking a grid into a cursor/table via its .RecordSource property.  We have 4 RecordSourceType to choose from but I am using only 2 at my end, i.e.:

a.  I am using Safe Select (2 cursors) Approach, then it is .RecordSourceType = 1 - Alias.
b.  I am using a single cursor approach (the same cursor gets overwritten over and over again), then it is .RecordSourceType = 4 - SQL Statement, for me.

Depending on my need, I switch either with RecordSourceType 1 or 4.