Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("ข้าวมันไก่ตอน(40)")
ComboBox1.Items.Add("ข้าวมันไก่ทอด(40)")
ComboBox1.Items.Add("ข้าวมันไก่สองสี(45)")
ComboBox1.Items.Add("ไก่ตอนสับ(50)")
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sum As Double
Dim sp As Double
Dim drink As Double
Dim total As Double
Dim plus As String
Dim bus As String
Dim dk = bus
Dim rd1 = plus
Dim rd2 = plus
Dim rd3 = plus
Dim rd4 = plus
Dim rd5 = plus
bus = ""
plus = ""
sum = 0
drink = 0
sp = 0
If ComboBox1.Text = ("ข้าวมันไก่ตอน(40)") Then
sum += 40
ElseIf ComboBox1.Text = ("ข้าวมันไก่ทอด(40)") Then
sum += 40
ElseIf ComboBox1.Text = ("ข้าวมันไก่สองสี(45)") Then
sum += 45
ElseIf ComboBox1.Text = ("ไก่ตอนสับ(50)") Then
sum += 50
End If
If CheckBox1.Checked Then
sp += 5
rd1 = "เพิ่มข้าว"
Else
rd1 = plus
End If
If CheckBox2.Checked Then
sum += 10
rd2 = "เพิ่มไก่"
Else
rd2 = plus
End If
If CheckBox3.Checked Then
sp += 5
rd3 = "เพิ่มเครื่องใน"
Else
rd3 = plus
End If
If CheckBox4.Checked Then
sp += 5
rd4 = "เพิ่มน้ำซุปใหญ่"
Else
rd4 = plus
End If
If CheckBox5.Checked Then
sp += 0
rd5 = "ไม่ใส่ผัก"
Else
rd5 = plus
End If
If RadioButton1.Checked Then
drink += 0
dk = " น้ำเปล่า"
End If
If RadioButton2.Checked Then
drink += 10
dk = " น้ำโค้ก"
End If
If RadioButton3.Checked Then
drink += 10
dk = " ชาเย็น"
End If
If RadioButton4.Checked Then
drink += 10
dk = " โอเลี้ยง"
End If
If RadioButton5.Checked Then
drink += 10
dk = " น้ำกระเจี๊ยบ"
End If
total = sum + sp + drink
TextBox1.Text = "ราคารวม" & total & "บาท"
If ComboBox1.Text = ("ข้าวมันไก่ตอน(40)") Then
ListBox1.Items.Add("ข้าวมันไก่ตอน" & rd1 & rd2 & rd3 & rd4 & rd5 & dk & total & "บาท")
ListBox2.Items.Add(total)
ElseIf ComboBox1.Text = ("ข้าวมันไก่ทอด(40)") Then
ListBox1.Items.Add("ข้าวมันไก่ทอด" & rd1 & rd2 & rd3 & rd4 & rd5 & dk & total & "บาท")
ListBox2.Items.Add(total)
ElseIf ComboBox1.Text = ("ข้าวมันไก่สองสี(45)") Then
ListBox1.Items.Add("ข้าวมันไก่สองสี" & rd1 & rd2 & rd3 & rd4 & rd5 & dk & total & "บาท")
ListBox2.Items.Add(total)
ElseIf ComboBox1.Text = ("ไก่ตอนสับ(50)") Then
ListBox1.Items.Add("ไก่ตอนสับ" & rd1 & rd2 & rd3 & rd4 & rd5 & dk & total & "บาท")
ListBox2.Items.Add(total)
End If
If CheckBox6.Checked Then
End If
CheckBox1.CheckState = CheckState.Unchecked
CheckBox2.CheckState = CheckState.Unchecked
CheckBox3.CheckState = CheckState.Unchecked
CheckBox4.CheckState = CheckState.Unchecked
CheckBox5.CheckState = CheckState.Unchecked
CheckBox6.CheckState = CheckState.Unchecked
plus = ""
ComboBox1.ResetText()
End Sub
Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub TextBox1_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ListBox1.Items.Clear()
ListBox2.Items.Clear()
CheckBox1.CheckState = CheckState.Unchecked
CheckBox2.CheckState = CheckState.Unchecked
CheckBox3.CheckState = CheckState.Unchecked
CheckBox4.CheckState = CheckState.Unchecked
CheckBox5.CheckState = CheckState.Unchecked
CheckBox6.CheckState = CheckState.Unchecked
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
End
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
End Sub
Private Sub ListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged
End Sub
End Class
Private sum As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
For i = 0 To ListBox1.Items.Count - 1
sum = sum + CInt(ListBox1.Items(i).ToString)
Next
TextBox1.Text = sum
End Sub