โปรแกรมร้านค้า

ร้านค้า

code

Public Class Form1
Dim n1, n2 As Single
Dim p1, p2, total As Single
Dim cash As Integer
Dim change As Single

Private Sub btn_sum_Click(sender As System.Object, e As System.EventArgs) Handles btn_sum.Click
n1 = Val(txt_n1.Text)
n2 = Val(txt_n2.Text)
p1 = Val(txt_p1.Text)
p2 = Val(txt_p2.Text)
total = (n1 * p1) + (n2 * p2)
lbl_total.Text = total
End Sub

Private Sub btn_change_Click(sender As System.Object, e As System.EventArgs) Handles btn_change.Click
cash = txt_cash.Text
change = cash – total
lbl_change.Text = change
End Sub

Private Sub txt_n1_TextChanged(sender As System.Object, e As System.EventArgs) Handles txt_n1.TextChanged
n1 = Val(txt_n1.Text)
n2 = Val(txt_n2.Text)
p1 = Val(txt_p1.Text)
p2 = Val(txt_p2.Text)
total = (n1 * p1) + (n2 * p2)
lbl_total.Text = total
End Sub

Private Sub txt_p1_TextChanged(sender As System.Object, e As System.EventArgs) Handles txt_p1.TextChanged
n1 = Val(txt_n1.Text)
p1 = Val(txt_p1.Text)
n2 = Val(txt_n2.Text)
p2 = Val(txt_p2.Text)
total = (n1 * p1) + (n2 * p2)
lbl_total.Text = total
End Sub

Private Sub txt_n2_TextChanged(sender As System.Object, e As System.EventArgs) Handles txt_n2.TextChanged
n1 = Val(txt_n1.Text)
p1 = Val(txt_p1.Text)
n2 = Val(txt_n2.Text)
p2 = Val(txt_p2.Text)
total = (n1 * p1) + (n2 * p2)
lbl_total.Text = total
End Sub

Private Sub txt_p2_TextChanged(sender As System.Object, e As System.EventArgs) Handles txt_p2.TextChanged
n1 = Val(txt_n1.Text)
p1 = Val(txt_p1.Text)
n2 = Val(txt_n2.Text)
p2 = Val(txt_p2.Text)
total = (n1 * p1) + (n2 * p2)
lbl_total.Text = total
End Sub
End Class

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s