Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Data

Public Class GridAdapter
  Private dtable As DataTable
  Private Dgrid As DataGrid

  Public Sub New(ByVal grid As DataGrid)
    MyBase.New()
    dtable = CType(grid.DataSource, DataTable)
    Dgrid = grid
  End Sub

  Public Sub addLine(ByVal p As Product)
    Dim scnt As String
    Dim row As DataRow

    Dgrid.ReadOnly = False

    row = dtable.NewRow
    row(0) = p.getName
    row(1) = p.getQty

    dtable.Rows.Add(row)
    dtable.AcceptChanges()
    Dgrid.ReadOnly = True

  End Sub
  Public Sub removeLine(ByVal num As Integer)
  End Sub

End Class
