0
Answer

Record Navigation System

Paul Cronin

Paul Cronin

16y
2.1k
1

I have a delete button that deletes two records at a time for some reason. Also i have a next and previous button that jump to every second record instead of the next. here is the code i have for them if anyone knows what i am doing wrong:

[code]Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
        Dim index As Integer = cboSNameView.SelectedIndex
        myDs.Tables("dtClients").Rows(index).Delete()
        oleDbDataAdapter1.Update(myDs, "dtClients")
        cboSNameView.Items.RemoveAt(index)
        currentRow = 0
        showData()
        MessageBox.Show("Record successfully deleted!")
    End Sub[/code]
[code]Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
        If currentRow < myDs.Tables("dtClients").Rows.Count - 1 Then
            currentRow += 1
        End If
        showData()
    End Sub
[/code]
[code]Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click
        If currentRow > 0 Then
            currentRow -= 1
        End If
        showData()
    End Sub
[/code]