Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you delete a record from grid row?

Status
Not open for further replies.

brownb1

Programmer
Jul 11, 2002
11
US
I have a grid row and I want to delete a record from one of the rows.
 
brownb1

[ol][li]In the load of the form put:
SET DELETE ON && To make the deleted record disapear.[/li]
[li]In the click event of your delete button :
THISFORM.GRID1.DELETEMARK = .T.&& Which will make a little box (or field) next to each records on the lef-hand side.[/LI]
[li]You can click in the little box (it should turn black)[/li]
[li]Somewhere do a TABLEUPDATE, THISFORM.GRID.DELETEMARK = .F., and a thisform.refresh()[/li][ol]

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi

You can do it in number of ways..
For Example..

In the rightClick event of the Grid.. put the code..
DELETE

SO when you run the form.. if you right click on the grid row.. that row will get deleted.. YOu can add code.. for safety..

Ans=MESSAGEBOX("Are you sure to DELETE",.... etc code

ANd delete or leave without deleting.

If you delete.. depending on SET DELE OFF the record will appear or not appear in the gird.. But to facilitate the correct display.. do a This.refresh()
Also SAKIP a record so that the pointer will be on a valid record.

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Note: Both Mike's and ramani's solutions assume you aren't working with a read-only cursor or view as your data source - you can't delete records in these.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top