I am trying to add a new record everytime i do my navigation gets all messed up I also need an update button... I would like so when i hit new record the record of will be(ex. If Im adding record number 30 it will say record 30 of 30, hit add new it will say record 31 of 31) my code is below.

'Class File
Module Class1
    Public MasterConnection As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=db1.mdb;Persist Security Info=False;")
    Public daMaster As OleDb.OleDbDataAdapter
    Public dsMaster As DataSet
    Public dtMaster As New Data.DataTable
   


End Module

'Main Form
Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim Intsize As Integer
    Private Sub LoadTheForm()
        daMaster = New OleDb.OleDbDataAdapter("Select * From Authors Order By lname ASC", "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=db1.mdb;Persist Security Info=False;")
        daMaster.Fill(dtMaster)
        txtBookTitle.DataBindings.Add("text", dtMaster, "Title")
        txtPrice.DataBindings.Add("text", dtMaster, "Price")
        txtLastName.DataBindings.Add("text", dtMaster, "lname")
        txtFirstName.DataBindings.Add("text", dtMaster, "fname")
        DisplayRecordPosition()
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadTheForm()
        'DisplayRecordPosition()
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub
   
    Private Sub ClearText()
        txtBookTitle.Text = ""
        txtFirstName.Text = ""
        txtLastName.Text = ""
        txtPrice.Text = ""
        
    End Sub
    Private Sub DisplayRecordPosition()

        Dim intRecordCount As Integer
        Dim intRecordPosition As Integer
        intRecordCount = dtMaster.Rows.Count
        intRecordPosition = Me.BindingContext(dtMaster).Position + 1
        If intRecordCount = 0 Then
            txtRecordPosition.Text = "(No records )"
        Else
            txtRecordPosition.Text = "Record " & intRecordPosition.ToString & _
           " of " & intRecordCount.ToString
        End If
       
    End Sub



    Private Sub btnMoveNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMoveNext.Click

        Try
            Me.BindingContext(dtMaster).Position += 1
            DisplayRecordPosition()
        Catch ex As Exception
            ' ignore errors
        End Try


    End Sub

    Private Sub btnMoveFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMoveFirst.Click

        Try
            Me.BindingContext(dtMaster).Position = 0
            DisplayRecordPosition()
        Catch ex As Exception
            ' ignore errors
        End Try

    End Sub

    Private Sub btnMovePrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMovePrevious.Click
        Try
            Me.BindingContext(dtMaster).Position -= 1
            DisplayRecordPosition()
        Catch ex As Exception
            ' ignore errors
        End Try

        
    End Sub

    Private Sub btnMoveLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMoveLast.Click
        Try
            With Me.BindingContext(dtMaster)
                .Position = .Count - 1
                DisplayRecordPosition()
            End With
        Catch ex As Exception
            ' ignore errors
        End Try
    End Sub


    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        Dim strSQLInsert As String
        strSQLInsert = "Insert Into Authors (Title, Price, lname, fname) Values('" & txtBookTitle.Text & "', '" & txtPrice.Text & "', '" & txtLastName.Text & "', '" & txtFirstName.Text & "')"

        Dim reply As DialogResult = MessageBox.Show(strSQLInsert, "Is This What You Want To Add", _
     MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)

        If reply = DialogResult.Yes Then
            Dim daUpdateMaster As New OleDb.OleDbDataAdapter(strSQLInsert, MasterConnection)
            Dim dsMaster As New DataSet

            Intsize = daUpdateMaster.Fill(dsMaster, "Authors")
            MessageBox.Show("Order Added")



        Else
            MessageBox.Show("Record Not Added", "Cancel", MessageBoxButtons.OK, MessageBoxIcon.None)
            txtLastName.Focus()
        End If




        'Catch ex As Exception
        'Display error message, if any.
        'MessageBox.Show(ex.Message)
        'End Try
    End Sub
End Class

Want to display n/N.

str=Me.BindingContext(dtMaster).Position & "/" & Me.BindingContext(dtMaster).Count

You're welcome
I'm glad you got it working. Please mark this thread as solved if you have found an answer to your question and good luck!

This question has already been answered. Start a new discussion instead.