VERSION 5.00
Begin VB.Form frmNapsackExample 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox Text2 
      Height          =   615
      Left            =   1440
      TabIndex        =   1
      Top             =   1080
      Width           =   1815
   End
   Begin VB.TextBox Text1 
      Height          =   615
      Left            =   1440
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   120
      Width           =   1815
   End
   Begin VB.Label Label2 
      Caption         =   "Items taken"
      Height          =   495
      Left            =   240
      TabIndex        =   3
      Top             =   1200
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "Total value in napsack"
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   360
      Width           =   1215
   End
End
Attribute VB_Name = "frmNapsackExample"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim WithEvents calc As clsNapSack
Attribute calc.VB_VarHelpID = -1

Private Sub calc_Solved(selection() As Byte, value As Double)
Text1 = value
For i = 1 To 5
    If selection(i) = 1 Then
        Text2 = Text2 & i & " "
    End If
Next
End Sub

Private Sub Form_Load()

'create example problem

Dim weight(5) As Double
Dim value(5) As Double

weight(0) = 20
weight(1) = 32
weight(2) = 22
weight(3) = 13
weight(4) = 8
weight(5) = 10
value(0) = 280
value(1) = 384
value(2) = 242
value(3) = 130
value(4) = 72
value(5) = 80

Set calc = New clsNapSack
calc.NapSack value(), weight(), 51

End Sub
