Imports System.Windows.Forms
Imports Microsoft.VisualBasic

Public Class print
  Inherits VERB
  Private kids As Kid()

  Public Sub New(ByVal s As String, ByVal kd As Data, ByVal pt As ListBox)
    MyBase.New(s, kd, pt)
    value = PRINT
  End Sub
  '-----------------------------------
  Public Overrides Sub Execute()
    Dim pline As String
    Dim i, j, k As Integer
    Dim tabc As Char

    kids = Data.getData()
    ptable.Items.Clear()
    For i = 0 To kids.Length - 1
      pline = ""
      For j = 0 To args.Count - 1
        Dim v As ParseVar = CType(args(j), ParseVar)
        If TypeOf (v) Is MultVar Then
          Dim mv As MultVar = CType(v, MultVar)
          Dim vlist As ArrayList = mv.getVector()
          For k = 0 To vlist.Count - 1
            Dim pv As ParseVar = CType(vlist(k), ParseVar)
            pline = pline + kids(i).getData(pv.getValue()).ToString + " "
          Next k
        Else
          pline = pline + kids(i).getData(v.getValue()).ToString + " "
        End If
        ptable.Items.Add(pline)
      Next j
    Next i
    ptable.Refresh()
  End Sub

End Class
