Home Forums WinForms controls Xceed Grid for WinForms Deleting a record Reply To: Deleting a record

User (Old forums)
Post count: 23064

To remove a row from the grid, you need to identify which row, or get a reference of the row in question, and remove it from the DataRows collection.

e.g. :

      //you can also use RemoveAt() if you know the index of the row.
      gridControl1.DataRows.Remove( ( Xceed.Grid.DataRow )gridControl1.CurrentRow );

This will also remove the row from the DataSet to which the grid is bound, through the CurrencyManager, which synchronizes both the grid and the DataSet together.

However to remove the same row from the DB, you need to update the DB through the data adapter that you use to fill the DataSet, and to accept the changes on the DataSet.  When filling the DataSet, the Fill() method is used; when updating the DB from the DataSet, the Update() method is used.


      this.suppliersTableAdapter.Update( this.northwindDataSet.Suppliers );

I suggest you read a bit on Data binding in .NET to learn how to do this.  Here is a few links that should get you started :



Imported from legacy forums. Posted by André (had 3636 views)