Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with deleted records in grids
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00720036
Message ID:
00720096
Views:
13
This message has been marked as the solution to the initial question of the thread.
This is a known VFP bug (versions 5 and 6, don't know about Version 7). To avoid this I usually use two cursors and when I delete a record from the main cursor copy all the records to the second cursor except the deleted one. I then append back the records to the original cursor.
   Set Deleted on
   Create cursor cursor1 (Code c(6), description c(10))
   Create cursor cursor2 (Code c(6), description c(10))


   ** here goes the code to append records into cursor1


   *** I usually put the following code in the click event of the Delete 
   *** record button

   Select Cursor1
   Delete
   *** Append the records to the second cursor

   Scan
     Scatter to memvar

     Select Cursor2
     Append Blank
     Gather from memvar

  EndScan

  Zap &&& Delete all records from cursor1

  *** Now Invert the process
 
   Select Cursor2
   Scan
     Scatter to memvar

     Select Cursor1
     Append Blank
     Gather from memvar

  EndScan

  *** And finally
  Thisform.Grid1.Refresh
This is the way I do it in my applications.

Enmanuel


>I've been looking though the archives and I can't find where some one may have had this same problem, so all ideas are welcome.
>
>I have a form that contains 2 grids. The first grid.recordsource is a cursor populated from a sql-select. In the doubleclick event of the textbox of this grid the selected record is added to the recordsource cursor of a second grid.
>
>Works wonderfully, but this is made so the user can change their mind. If a record is removed from the second grid, and then another record is added from the first grid, there is a blank row corresponding at the place held by the deleted record.
>
>There are blank spaces for all the records that are deleted. The record order seems to be whacked as well. Click on a record to delete it and the record above it deletes instead. If you try to delete all the records that were added after deleting one record, the last record is visible but cannot be deleted. The deletion is being fired by the doubleclick of the textbox in the second grid.
>
>TIA
I'm a mixture of Albert Einstein and Arnold Schwarzenegger. The only trouble is that I got Einstein's body and Schwarzenegger's brain
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform