1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| Public Class Listenumdossiermaitre
Private m_col As System.Collections.Generic.LinkedList(Of Integer)
Public Sub New()
Connect1()
Dim sql1 As String = "SELECT Id_Dossiermaitre FROM Tabledossiermaitre ORDER BY Id_Dossiermaitre;"
Dim cmd As New OleDb.OleDbCommand(sql1, Cnn1)
Dim da As New OleDb.OleDbDataAdapter()
da.SelectCommand = cmd
Dim ds As New DataSet
da.Fill(ds)
Dim row As DataRow = ds.Tables(0).Rows(0)
Dim l() As Integer
Dim i As Integer
i = -1
ReDim l(0)
For Each row In ds.Tables(0).Rows
i = i + 1
ReDim Preserve l(i)
l(i) = row("Id_Dossiermaitre")
Next
m_col = New System.Collections.Generic.LinkedList(Of Integer)(l)
Deconnect1()
End Sub
Public Function NumPrec(ByVal I As Integer) As Integer
Dim node As LinkedListNode(Of Integer) = m_col.Find(I)
If node.Previous Is Nothing Then
NumPrec = I
Else
NumPrec = node.Previous.Value
End If
End Function
Public Function NumSuiv(ByVal I As Integer) As Integer
Dim node As LinkedListNode(Of Integer) = m_col.Find(I)
If node.Next Is Nothing Then
NumSuiv = I
Else
NumSuiv = node.Next.Value
End If
End Function
Public Function Premier() As Integer
Dim node As LinkedListNode(Of Integer) = m_col.First
Premier = node.Value
End Function
Public Function Dernier() As Integer
Dim node As LinkedListNode(Of Integer) = m_col.Last
Dernier = node.Value
End Function
End Class |