> Hi all,
>
> Do you know how to select multiple rows in the grid? Is there another way if I don't want to add a field with checkbox? So I want to allow the user to drag the rows that they want to delete (something like microsoft excel). I tried to search it and actually i got an interesting article from
http://www.tek-tips.com/faqs.cfm?fid=433. But to be honest I am not really expert in Foxpro and I don't know how to add properties in the grid. So when I tried that coding, I found error message because I put the properties in the form instead of in the grid. So stupid right :( so I am waiting your help about select multiple rows in the grid.
>
> Thanks all
>
> Ursula
One simple but not very elegant way is to use the 'Delete Mark' of the grid (ie The leftmost small column of the Grid) You can let the user click this column to mark a record for Deletion. The user can mark all the records he/she wants deleted. You will need to put a command button on the FORM.
In the click event of this command button you can put code to 'Pack' the recordsource of the grid and refresh the grid.
Another option is to add a special logical (true/false) column to the recordsource of the grid.
In the grid you can replace the textbox with a Checkbox for this column which will serve the same purpose as a Delete Marker. You can put code in the click of the command button to Delete All records in the recordsource of the Grid which have been selected by the user and then pack the recordsource of the grid and refresh the grid.
You need not only "delete and pack" but you can achive other objectives based the records marked as deleted
eg
Scan for Deleted()
** do whatever you need to do with the record
Endscan
If you are not using a temporary cursor as the recordsoure, you will need to
recall all
records marked for deletion.
Experts will surely provide you with more elegant solutions!
kulwant