[COLOR=seagreen]'general decs[/COLOR]
[COLOR=royalblue]Option Explicit[/COLOR]
Dim Change, MoneyIn, Itemprice[COLOR=royalblue] As Double[/COLOR]
Dim Selected [COLOR=royalblue]As Integer[/COLOR]
Dim Item(7, 1), ItemName [COLOR=royalblue]As String[/COLOR]
[COLOR=royalblue]Private Sub[/COLOR] Calculate_Click() [COLOR=seagreen]'command button[/COLOR]
[COLOR=seagreen]'if the user enters their amount via a text box[/COLOR]
[COLOR=seagreen]'then the algorithm will be:[/COLOR]
MoneyIn = Money.Text 'name of textbox
Itemprice = Item(Selected, 1)
Change = MoneyIn - Itemprice
lblChange.Caption = Format(Change, "$##.00")
Call Vend(ItemName) [COLOR=seagreen]'this is the sub where u graphically vend it[/COLOR]
[COLOR=royalblue]End Sub[/COLOR]
[COLOR=royalblue]Private Sub[/COLOR] Form_Load()
[COLOR=seagreen]'below is an example of an item within your machine[/COLOR]
[COLOR=seagreen]'coke is placed in the first position, ie: the top[/COLOR]
[COLOR=seagreen]'left spot. The images themselves should be placed[/COLOR]
[COLOR=seagreen]'in a control array.[/COLOR]
[COLOR=seagreen]' __________[/COLOR]
[COLOR=seagreen]' / \[/COLOR]
[COLOR=seagreen]' | 0 1 2 |[/COLOR]
[COLOR=seagreen]' | |[/COLOR]
[COLOR=seagreen]' | 3 4 5 |[/COLOR]
[COLOR=seagreen]' | |[/COLOR]
[COLOR=seagreen]' | 6 7 8 |[/COLOR]
[COLOR=seagreen]' | |[/COLOR]
[COLOR=seagreen]' ------------[/COLOR]
Item(0, 0) = "Coke" 'item name
Item(0, 1) = 3.5 'item price
[COLOR=seagreen]'positions 1 to 8 (or further) are filled with other items[/COLOR]
[COLOR=royalblue]End Sub[/COLOR]
[COLOR=royalblue]Private Sub[/COLOR] picItem_Click(Index [COLOR=royalblue]As Integer[/COLOR])
Selected = Index
[COLOR=royalblue]End Sub[/COLOR]