here is the scenario:
i searched for record having "a" in their title, it will then show results (i used bindingnavigator in Details). everytime i try to delete records these problems occurred:
Quote
First Problem.
if the result is more than one (1), for example it displayed three (3) records and i press the delete button, 2 records that is displayed will be removed, one(1) was removed permanently and the other was removed just from the list.
if the result is more than one (1), for example it displayed three (3) records and i press the delete button, 2 records that is displayed will be removed, one(1) was removed permanently and the other was removed just from the list.
Quote
Second Problem.
if the result is only one (1), then this error occurs "Current item cannot be removed from the list because there is no current item".
if the result is only one (1), then this error occurs "Current item cannot be removed from the list because there is no current item".
Here is the code i'm using:
Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
Try
If MessageBox.Show("Are you sure you want to delete the current record?", _
"Confirm Delete", _
MessageBoxButtons.OKCancel, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.OK Then
Me.DetailsBindingSource2.RemoveCurrent()
Me.Validate()
Me.DetailsBindingSource2.EndEdit()
Me.TableAdapterManager2.UpdateAll(Me.DataSet3)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

New Topic/Question
Reply



MultiQuote



|