|
-
May 5th, 2009, 10:50 AM
#1
Thread Starter
New Member
[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? 
Many thanks in advance.
Last edited by tonyblack.co.uk; May 5th, 2009 at 12:26 PM.
-
May 5th, 2009, 12:01 PM
#2
Frenzied Member
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
-
May 5th, 2009, 12:25 PM
#3
Thread Starter
New Member
Re: removing a record from a table using a datagrid control
Just the job, worked like a charm.
Many thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|