Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: kulwant singh
  Where is kulwant singh?
 Shimla
 India
 kulwant singh
 To: ursula
  Where is ursula?
 jakarta
 Indonesia
 ursula
 Tags
Subject: RE: Select multiple rows in grid
Thread ID: 232037 Message ID: 232043 # Views: 62 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Friday, June 19, 2009 8:08:59 AM         
   


> 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



COMPLETE THREAD
Select multiple rows in grid Posted by ursula @ 6/19/2009 7:20:47 AM
RE: Select multiple rows in grid Posted by kulwant singh @ 6/19/2009 8:08:59 AM
RE: Select multiple rows in grid Posted by ursula @ 6/19/2009 8:18:30 AM
RE: Select multiple rows in grid Posted by Stefan Wuebbe @ 6/19/2009 8:40:01 AM
RE: Select multiple rows in grid Posted by ursula @ 6/19/2009 9:53:22 AM
RE: Select multiple rows in grid Posted by Stefan Wuebbe @ 6/20/2009 10:58:23 AM
RE: Select multiple rows in grid Posted by ursula @ 6/22/2009 5:48:42 AM
RE: Select multiple rows in grid Posted by Marcia Akins @ 6/20/2009 3:40:58 PM
RE: Select multiple rows in grid Posted by Stefan Wuebbe @ 6/20/2009 6:48:00 PM
RE: Select multiple rows in grid Posted by Yousfi Benameur @ 6/21/2009 2:31:09 AM
RE: Select multiple rows in grid Posted by ursula @ 6/22/2009 3:41:34 AM
RE: Select multiple rows in grid Posted by ursula @ 6/22/2009 6:28:26 AM
RE: Select multiple rows in grid Posted by Stefan Wuebbe @ 6/22/2009 9:07:40 AM
RE: Select multiple rows in grid Posted by Yousfi Benameur @ 6/22/2009 11:06:10 AM
RE: Select multiple rows in grid Posted by ursula @ 6/22/2009 11:23:14 AM
RE: Select multiple rows in grid Posted by Chris Chamberlain @ 6/22/2009 11:36:09 AM
RE: Select multiple rows in grid Posted by Yousfi Benameur @ 6/22/2009 11:49:37 AM
RE: Select multiple rows in grid Posted by Cetin Basoz @ 6/22/2009 1:58:59 PM
RE: Select multiple rows in grid Posted by ursula @ 6/22/2009 5:39:48 PM