2019年4月13日 星期六
小柯茶行開張囉!
Public Class Form1
Dim a(12) As Integer
Dim sum(12) As Integer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
a(0) = TextBox1.Text
sum(0) = a(0) * 25
Label10.Text = "共" & sum(0) & "元"
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
a(1) = TextBox2.Text
sum(1) = a(1) * 30
Label11.Text = "共" & sum(1) & "元"
End Sub
Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
a(2) = TextBox3.Text
sum(2) = a(2) * 25
Label12.Text = "共" & sum(2) & "元"
End Sub
Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs) Handles TextBox4.TextChanged
a(3) = TextBox4.Text
sum(3) = a(3) * 30
Label13.Text = "共" & sum(3) & "元"
End Sub
Private Sub TextBox5_TextChanged(sender As Object, e As EventArgs) Handles TextBox5.TextChanged
a(4) = TextBox5.Text
sum(4) = a(4) * 35
Label18.Text = "共" & a(4) * 35 & "元"
End Sub
Private Sub TextBox6_TextChanged(sender As Object, e As EventArgs) Handles TextBox6.TextChanged
a(5) = TextBox6.Text
sum(5) = a(5) * 40
Label19.Text = "共" & a(5) * 40 & "元"
End Sub
Private Sub TextBox7_TextChanged(sender As Object, e As EventArgs) Handles TextBox7.TextChanged
a(6) = TextBox7.Text
sum(6) = a(6) * 45
Label20.Text = "共" & a(6) * 45 & "元"
End Sub
Private Sub TextBox8_TextChanged(sender As Object, e As EventArgs) Handles TextBox8.TextChanged
a(7) = TextBox8.Text
sum(7) = a(7) * 50
Label21.Text = "共" & a(7) * 50 & "元"
End Sub
Private Sub TextBox16_TextChanged(sender As Object, e As EventArgs) Handles TextBox16.TextChanged
a(8) = TextBox16.Text
sum(8) = a(8) * 50
Label22.Text = "共" & sum(8) & "元"
End Sub
Private Sub TextBox15_TextChanged(sender As Object, e As EventArgs) Handles TextBox15.TextChanged
a(9) = TextBox15.Text
sum(9) = a(9) * 40
Label23.Text = "共" & sum(9) & "元"
End Sub
Private Sub TextBox14_TextChanged(sender As Object, e As EventArgs) Handles TextBox14.TextChanged
a(10) = TextBox14.Text
sum(10) = a(10) * 70
Label24.Text = "共" & sum(10) & "元"
End Sub
Private Sub TextBox13_TextChanged(sender As Object, e As EventArgs) Handles TextBox13.TextChanged
a(11) = TextBox13.Text
sum(11) = a(11) * 90
Label25.Text = "共" & sum(11) & "元"
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim tol As Integer
For i = 0 To 11
tol += sum(i)
Next
Label26.Text = "本次結帳" & vbCrLf & "共" & tol & "元"
End Sub
End Class
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言