[RESOLVED] removing a record from a table using a datagrid control
I am using Visual Studio 2008 to create a Smart Device application.
I have a form containing a DataGrid (dgShoppingList) which is bound to a BindingSource (TblListItemsBindingSource).
This BindingSource has a DataSource (DataSetListItems) and this DataSet contains a table (tblListItems).
I have a button (name: btnDelete) on the form with the following code for its on-click event:
Dim myRow As String
myRow = dgShoppingList.CurrentRowIndex
TblListItemsBindingSource.RemoveAt(myRow)
My objective is to allow the form user to select a row (record) in the DataGrid and then by clicking on the btnDelete button remove the selected record from the tblListItems table permanently (and consequently remove the row from the DataGrid).
My code doesn't seem to do the job. It is seemingly removing the item from the DataGrid but not from the table.
If I carry out a delete operation and close the application, once I reopen the application the previously deleted item is still visable in the DataGrid.
Can anyone point me in the right direction? :confused:
Many thanks in advance.
Re: removing a record from a table using a datagrid control
Hi,
you need to update the table similar to
Me.myTableAdapter.Update(Me.myDataSet.Customers)
after removing the record from the binding source
Pete
Re: removing a record from a table using a datagrid control
Just the job, worked like a charm.
Many thanks.