StrataFrame Forum

DeleteCurrentRow not deleting current row

http://forum.strataframe.net/Topic3983.aspx

By Andria Jensen - 10/30/2006

I have a BO that I have attached to a user control and am doing a delete operation on it from within the user control.  I set the BO to the record I wish to delete and then call BO.DeleteCurrentRow(False).  This seems to be deleting the last record in the BO every time regardless of what row it is currently on.  I can look at the data in the BO and it matches the row I wish to delete (the current row) right before DeleteCurrentRow is called, but it doesn't delete that row.  Any ideas as to why this could be occurring?  Thanks
By Trent L. Taylor - 10/30/2006

Do you have any code in the BeforeDelete event or is there something that could be firing in your environment that is moving the record pointer?  To make sure that to BO is OK, create a new form, drop the BO on the form, and manually populate the BO.  Add a button to delete the current row.  Does it delete only the last record? 

Is the BO that you are deleting from tied to a grid? 

By Andria Jensen - 10/30/2006

OK, I think I got it.  The current row on the BO was getting moved because the CustomColumnDisplayText event was firing on a grid which was calling a MoveAbsolute on the BO.  I just restructured the code so it wouldn't have to change rows and it now deletes the correct row.  Thanks for the help.
By Trent L. Taylor - 10/30/2006

Sure...it is generally some event moving the record pointer when you see a symtom like that.  Glad you found it Smile