[RESOLVED] Deleting row from a typed dataset
Hello,
I am deleting a row from a row that is currently selected on a datagridview.
I am using a Typed dataset and my datagridview is bounded to a binding source.
However, I think my technique is not the best, even though it works.
Many thanks for any advice,
Code:
Dim drDelete() As DataRow
' Get the value of the PK from the currently selected row
Dim drv As DataRowView = CType(bsAddressBook.Current, DataRowView)
Dim index As Integer = Convert.ToInt16(drv(0))
' Find the actual data row from the primary key and delete the row
drDelete = dsCATDialer.AddressBook.Select(String.Format("ID = '{0}'", index))
dsCATDialer.AddressBook.Rows.Remove(drDelete(0))
Re: Deleting row from a typed dataset
Just call RemoveCurrent on the BindingSource.