DATAROW - DATATABLE Muoversi tra i record






Private Sub BtnRight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnRight.Click

If (DatTableArticoli.Rows.Count > currentRowIndex + 1) Then
currentRowIndex += 1
drRow = DatTableArticoli.Rows(currentRowIndex)
TxtId.Text = drRow.Item("Id")
If (drRow.Isnull("Articolo")) = False Then
TxtName.Text = drRow.Item("Articolo")
End If

End If
End Sub

Private Sub BtnLeft_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLeft.Click

If (currentRowIndex - 1 >= 0 And DatTableArticoli.Rows.Count > 0) Then
currentRowIndex -= 1
drRow = DatTableArticoli.Rows(currentRowIndex)
TxtId.Text = drRow.Item("Id")
If (drRow.Isnull("Articolo")) = False Then
TxtName.Text = drRow.Item("Articolo")
End If

End If
End Sub

Private Sub BtnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFirst.Click

If (DaTableArticoli.Rows.Count > 0) Then
currentRowIndex = 0
drRow = DatTableArticoli.Rows(currentRowIndex)
TxtId.Text = drRow.Item("Id")
If (drRow.Isnull("Articolo")) = False Then
TxtName.Text = drRow.Item("Articolo")
End If

End If
End Sub

Private Sub BtnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLast.Click

If (DatTableArticoli.Rows.Count > 0) Then
currentRowIndex = DatTableArticoli.Rows.Count - 1
drRow = DatTableArticoli.Rows(currentRowIndex)
TxtId.Text = drRow.Item("Id")
If (drRow.Isnull("Articolo")) = False Then
TxtName.Text = drRow.Item("Articolo")
End If
End If
End Sub










( datarowdatatablemuoversitrairecord.html )- by Paolo Puglisi - Modifica del 17/12/2023