List Class in VB

Back to home page 

   Option Explicit

Private top As Node, p As Node, prev As Node

 

Public Sub add(dir As String, nextitem As Integer, track As Integer, typeofitem As String)

 

Set p = New Node

p.dir = dir

p.nextitem = nextitem

p.track = track

p.typeofitem = typeofitem

If top Is Nothing Then

Set top = New Node

Set top.link = p

Else

Set p.link = top.link

Set top.link = p

End If

p.printnode

 

End Sub

 

 

Public Sub printlist()

 

Set p = top.link

While Not (p Is Nothing)

MsgBox p.nextitem

Set p = p.link

Wend

MsgBox "Done"

End Sub

 

'Public Sub deletenode(key As String)

 

 

' Set prev = top

' Set p = top.link

' While Not (p Is Nothing)

' If p.key = key Then

' Set prev.link = p.link

' End If

' Set prev = p

' Set p = p.link

' Wend

'End Sub