Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
'clears each box back to zero so it does not stack.
onehun.Text = "0"
fifty.Text = "0"
twenty.Text = "0"
ten.Text = "0"
five.Text = "0"
two.Text = "0"
one.Text = "0"
pfive.Text = "0"
ptwenty.Text = "0"
pten.Text = "0"
pointfive.Text = "0"
'each of these if statements and loops are designed so that it checks if the'
'sum fits inside the ammount of money left to give if it fits it minuses the note from the sum and adds one to how many notes you need.'
Do
If TextBox2.Text / 100 >= 1 Then
onehun.Text = Val(onehun.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 100
End If
Loop Until TextBox2.Text / 100 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 50 >= 1 Then
fifty.Text = Val(fifty.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 50
End If
Loop Until TextBox2.Text / 50 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 20 >= 1 Then
twenty.Text = Val(twenty.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 20
End If
Loop Until TextBox2.Text / 20 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 10 >= 1 Then
ten.Text = Val(ten.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 10
End If
Loop Until TextBox2.Text / 10 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 5 >= 1 Then
five.Text = Val(five.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 5
End If
Loop Until TextBox2.Text / 5 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 2 >= 1 Then
two.Text = Val(two.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 2
End If
Loop Until TextBox2.Text / 2 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 1 >= 1 Then
one.Text = Val(one.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 1
End If
Loop Until TextBox2.Text / 1 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 0.5 >= 1 Then
pfive.Text = Val(pfive.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 0.5
End If
Loop Until TextBox2.Text / 0.5 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 0.2 >= 1 Then
ptwenty.Text = Val(ptwenty.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 0.2
End If
Loop Until TextBox2.Text / 0.2 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 0.1 >= 1 Then
pten.Text = Val(pten.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 0.1
End If
Loop Until TextBox2.Text / 0.1 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 0.05 >= 1 Then
pointfive.Text = Val(pointfive.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 0.05
End If
Loop Until TextBox2.Text / 0.05 < 1 Or
TextBox2.Text = "0"
End Sub
'clears each box back to zero so it does not stack.
onehun.Text = "0"
fifty.Text = "0"
twenty.Text = "0"
ten.Text = "0"
five.Text = "0"
two.Text = "0"
one.Text = "0"
pfive.Text = "0"
ptwenty.Text = "0"
pten.Text = "0"
pointfive.Text = "0"
'each of these if statements and loops are designed so that it checks if the'
'sum fits inside the ammount of money left to give if it fits it minuses the note from the sum and adds one to how many notes you need.'
Do
If TextBox2.Text / 100 >= 1 Then
onehun.Text = Val(onehun.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 100
End If
Loop Until TextBox2.Text / 100 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 50 >= 1 Then
fifty.Text = Val(fifty.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 50
End If
Loop Until TextBox2.Text / 50 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 20 >= 1 Then
twenty.Text = Val(twenty.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 20
End If
Loop Until TextBox2.Text / 20 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 10 >= 1 Then
ten.Text = Val(ten.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 10
End If
Loop Until TextBox2.Text / 10 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 5 >= 1 Then
five.Text = Val(five.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 5
End If
Loop Until TextBox2.Text / 5 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 2 >= 1 Then
two.Text = Val(two.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 2
End If
Loop Until TextBox2.Text / 2 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 1 >= 1 Then
one.Text = Val(one.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 1
End If
Loop Until TextBox2.Text / 1 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 0.5 >= 1 Then
pfive.Text = Val(pfive.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 0.5
End If
Loop Until TextBox2.Text / 0.5 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 0.2 >= 1 Then
ptwenty.Text = Val(ptwenty.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 0.2
End If
Loop Until TextBox2.Text / 0.2 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 0.1 >= 1 Then
pten.Text = Val(pten.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 0.1
End If
Loop Until TextBox2.Text / 0.1 < 1 Or
TextBox2.Text = "0"
Do
If TextBox2.Text / 0.05 >= 1 Then
pointfive.Text = Val(pointfive.Text) + 1
TextBox2.Text = Val(TextBox2.Text) - 0.05
End If
Loop Until TextBox2.Text / 0.05 < 1 Or
TextBox2.Text = "0"
End Sub