I have a staff details form and there are two different tables in it. The tables are Department and Staff Details.
Here is my form.
Name:  navigator.jpg
Views: 1574
Size:  49.5 KB


For the department fields there's a navigator and it only navigates the department code and department name.
here is the code.
Code:
Imports System.Data.OleDb
Public Class Staff_Editor
    Dim dbcursor As Integer
    Dim inc As Integer
    Dim MaxRows As Integer
    Dim conn As New OleDb.OleDbConnection
    Dim dbProvider As String
    Dim dbSource As String
    Dim dj As New DataSet
    Dim da As OleDb.OleDbDataAdapter
    Dim sql As String = "SELECT * FROM Department"
 Private Sub Staff_Editor_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        dbProvider = "Provider=Microsoft.ACE.OLEDB.12.0;"
        dbSource = "Data Source=|DataDirectory|\Payroll_BackEnd.accdb"
        conn.ConnectionString = dbProvider & dbSource
        conn.Open()

        da = New OleDb.OleDbDataAdapter(sql, conn)
        da.Fill(dj, "Payroll_BackEnd")
        MaxRows = da.Fill(dj, "Payroll_BackEnd")
        DepartmentCodeTextBox1.Enabled = False
        DepartmentNameTextBox.Enabled = False

 Private Sub NavigateRecords()
        DepartmentCodeTextBox1.Text = dj.Tables("Payroll_BackEnd").Rows(inc).Item(0)
        DepartmentNameTextBox.Text = dj.Tables("Payroll_BackEnd").Rows(inc).Item(1)
    End Sub

Private Sub NextRecordButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NextRecordButton.Click
        If inc <> MaxRows - 1 Then
            inc = inc + 1
            NavigateRecords()
        Else
            MsgBox("No More Rows")
        End If
    End Sub

    Private Sub PreviousRecordButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PreviousRecordButton.Click
        If inc > 0 Then
            inc = inc - 1
            NavigateRecords()
        ElseIf inc = -1 Then
            MsgBox("No Records Yet")
        ElseIf inc = 0 Then
            MsgBox("First Record")
        End If
    End Sub

    Private Sub FirstRecordButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FirstRecordButton.Click
        If inc <> 0 Then
            MsgBox("This is the First Record")
            inc = 0
            NavigateRecords()
        End If
    End Sub

    Private Sub LastRecordButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LastRecordButton.Click
        If inc <> MaxRows - 1 Then
            MsgBox("This is the Last Record")
            inc = MaxRows - 1
            NavigateRecords()
        End If
    End Sub
I have used parameters to delete, save, update.
So all i am asking is that if I use binding navigator without using any code will it create any error??
Is it possible to have bindingsource, bindingnavigators and dataset to connect my staff Details form so that i could navigate to records???