Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP : Grid turns blank when ...
Message
From
04/01/2000 02:12:30
Al Doman (Online)
M3 Enterprises Inc.
North Vancouver, British Columbia, Canada
 
 
To
04/01/2000 01:58:29
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00312149
Message ID:
00312189
Views:
25
>Al,
>
>I didn't touch the rowsource. I just delete the child and pack it.
>
That's your problem right there. Using PACK in the middle of an app is very bad practice. At the very least, it requires EXCLUSIVE use of the table and will not work in a multi-user environment.

The PACK command copies the undeleted records out to a temporary file, DELETES THE ORIGINAL FILE, then copies the temporary file back to a new one with the same name as the old one. The old file temporarily disappears completely. It's because the file temporarily ceases to exist, that the problem arises. I don't know too much about Windows internals, but I'd suspect that you lose the file handle to the table when you do this. In effect, the PACK causes the grid to lose its RowSource.

I don't know how much VFP programming background you have, but a more common practice is to SET DELETED ON (which causes deleted records to not appear in most commands). Then, all you need to do is issue a MyGrid.Refresh() and it will no longer display them.

If you're using a private datasession for the form, you need to issue the SET DELETED ON (as well as all the other datasession-specific SET commands) in the .Load event of a form class, or the .BeforeOpenTables event of a form's data environment.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform