Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.DataLoad()

Me.DataGridView1.DataSource = ProductDataSet.Tables("Product")

Me.showCurr()

         End Sub

 

Private Sub showCurr()

'Shows the current position of the record in binding context

Dim curPos As String

curPos = (Me.BindingContext(ProductDataSet, "Product").Position + 1).ToString _

        & " of  " & Me.BindingContext(ProductDataSet, "Product").Count.ToString

Label2.Text = curPos

End Sub

 

Private Sub moveNext()

Dim curPos As String

Me.BindingContext(ProductDataSet, "Product").Position = _

(Me.BindingContext(ProductDataSet, "Product").Position + 1)

 

curPos = (Me.BindingContext(ProductDataSet, "Product").Position + 1).ToString _

        & " of  " & Me.BindingContext(ProductDataSet, "Product").Count.ToString

Label2.Text = curPos

End Sub

Private Sub movePrevious()

Dim curPos As String

Me.BindingContext(ProductDataSet, "Product").Position = _

Me.BindingContext(ProductDataSet, "Product").Position - 1)

 

curPos = (Me.BindingContext(ProductDataSet, "Product").Position + 1).ToString _

        & " of  " & Me.BindingContext(ProductDataSet, "Product").Count.ToString

Label2.Text = curPos

End Sub

Private Sub moveFirst()

Dim curPos As String

Me.BindingContext(ProductDataSet, "Product").Position = 0

curPos = (Me.BindingContext(ProductDataSet, "Product").Position + 1).ToString _

                & " of  " & Me.BindingContext(ProductDataSet, "Product").Count.ToString

Label2.Text = curPos

End Sub

Private Sub moveLast()

Dim curPos As String

Me.BindingContext(ProductDataSet, "productCatogory").Position = _

Me.BindingContext(ProductDataSet, "Product").Count - 1

       curPos = (Me.BindingContext(ProductDataSet, "Product").Position + 1).ToString _

                        & " of  " & Me.BindingContext(ProductDataSet, "Product").Count.ToString

Label2.Text = curPos

End Sub