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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I dele a row on a grid with code?? 1

Status
Not open for further replies.

Gert

Programmer
Apr 9, 2000
240
DO
HI all
I wolud like to know if there is a way where i can delete a row using code.

 
Yes you can

have a button for performing the delete function in your form. when clicked it should perform the following

in the grid highlight the row to be deleted
select the cursor linked to the grid and make it current
issue the delete command and any other validations as necessary.
refresh the grid (THISFORM.grid.refresh())

hope this helps

Regards
 
It will be good if you insert
Code:
THISFORM.LOCKSCREEN=.T.
Before you delete you record and

Code:
THISFORM.LOCKSCREEN=.F.
After you done, so you give your user a much better and stable GUI. Walid Magd
Engwam@Hotmail.com
 
Hi,
1. If you set MyGrid.DeleteMark = .t. then you can delete by clicking on the Delete column of the Grid. This option is little dangerous with some users not understanding the Delete Marking concept. So generaly, the DeleteMark property need to be set as .f. to hide this column.
2. If you are not able to use option 1 said above, you can create a right click event for the grid.
MyGrid.RightClickEvent()
========================
** REMEMBER TO CHECK WHAT IS YOUR DEFAULT ALIAS
** AND SET SUITABLY THE ALIAS

DELETE

** CODE YO LOCATE THE RECORD POIBET SUITABLY
** FOR EXAMPLE....

SKIP
IF EOF()
SKIP -1
ENDIF
IF BOF()
APPEND A BLANK && ETC WHATEVER YOU NEED
ENDIF

=======================
hOPE THIS HELPS YOU. :) ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
FYI, If you delete a record, it will be present but marked as deleted.

IF you do not want to show deleted records (I assume you don't..;-) ), put the following statement in your forms INIT() event:

SET DELETED ON

HTH,
Weedz (Wietze Veld) They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best. - Steve McConnell
 
I would like to Delete a ROW not a Columns.

Thanks weedz I'will try this way, because I can replace the field on the database using Blank next 1, but it show me the empty row, and I would like that the dele row dosn't show up on the grid.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top