Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete current record in a grid
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Forms
Title:
Delete current record in a grid
Miscellaneous
Thread ID:
00905208
Message ID:
00905208
Views:
58
Hi all,

I'm new to VS.NET (having a background in VFP). I'm trying to set up a basic Win form with a grid (browsing a table in dataset) and a "Delete" button on the form to delete the current record.

My first try works some of the time, but fails when the grid is sorted because the grid RowNumber no longer matches the table Row record number.
private void btnDelete_Click(object sender, System.EventArgs e)
{
  int iPos = this.dataGrid1.CurrentCell.RowNumber;
  this.dataSet11.authors.Rows[iPos].Delete();  
}
So, is there a way to get the table Row directly from the grid so the table.Rows[iPos].Delete() command can be used?

If not, should I get the PK of the current grid row and use that to locate the record in the table for deletion?

I'm used to thinking in terms of a record pointer in VFP, with LOCATE FOR and SEEK() as a way of positioning it. Any discussion of equivalent concepts in VS would be appreciated.

TIA,
Larry Tucker
Next
Reply
Map
View

Click here to load this message in the networking platform