I'm trying to allow a user to delete a row from a datagrid (whose datasource is a datatable) using a 'Delete Row' button. To do this I:
Private Sub DeleteRowButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteRowButton.Click
Dim dTotal As Decimal
Dim deletedDataRow As DataRow1
Dim cm As CurrencyManager = CType(Me.BindingContext(TransactionDataGrid.DataSource, TransactionDataGrid.DataMember), CurrencyManager)
Dim transactionDataView As DataView = CType(cm.List, DataView)
The problem occurs when the user is on the new row (asterix row) of the datatable and tries to delete this row. Instead of the 'asterix' row being deleted it deletes the previous row that was current. I think this occurs because the current row does not change when you click on the 'asterix' row but can appear that it way because it is highlighted. One solution I have tried is to determine if a row is the 'asterix' row. Unfortunately I have not found a way to identify this.
Any insight on this problem would be greatly appreciated. If you require some more information, please let me know.
Thanks in advance for your help.