First Declare two variables n and mx.............
Dim n As Integer = 0
Dim mx As Integer
Make one function for moving........
Public Sub next1()
TextBox1.Text = ds.Tables(0).Rows(n).Item(0).ToString
TextBox2.Text = ds.Tables(0).Rows(n).Item(1).ToString
TextBox3.Text = ds.Tables(0).Rows(n).Item(2).ToString
End Sub
Here, it will show 'n' th row's data and for first record n = 0 and for last data n = mx -1
MX means maximum data but data start indexing start with 0 so last data is n= mx-1
For first button........
For Last Button....
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
For Next Button.......
For Previous Data............
Dim n As Integer = 0
Dim mx As Integer
Make one function for moving........
Public Sub next1()
TextBox1.Text = ds.Tables(0).Rows(n).Item(0).ToString
TextBox2.Text = ds.Tables(0).Rows(n).Item(1).ToString
TextBox3.Text = ds.Tables(0).Rows(n).Item(2).ToString
End Sub
Here, it will show 'n' th row's data and for first record n = 0 and for last data n = mx -1
MX means maximum data but data start indexing start with 0 so last data is n= mx-1
For first button........
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
cn.Open()
n = 0
next1()
cn.Close()
End Sub
For Last Button....
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
cn.Open()
mx = ds.Tables(0).Rows.Count
n = mx - 1
next1()
cn.Close()
End Sub
For Next Button.......
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
cn.Open()
mx = ds.Tables(0).Rows.Count
If (n <> mx - 1) Then
n = n + 1
next1()
Else
MsgBox("This is your last data")
End If
cn.Close()
End Sub
For Previous Data............
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
cn.Open()
mx = ds.Tables(0).Rows.Count
If (n <> 0) Then
n = n - 1
next1()
Else
MsgBox("This is your first data")
End If
cn.Close()
End Sub
cn.Open()
mx = ds.Tables(0).Rows.Count
If (n <> 0) Then
n = n - 1
next1()
Else
MsgBox("This is your first data")
End If
cn.Close()
End Sub